Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6562339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:41:51+00:00 2026-05-25T13:41:51+00:00

Lets say I have CSS like this: div.form label input { /* some css

  • 0

Lets say I have CSS like this:

div.form label input {
      /* some css here */
}

However this will apply to all of my input elements. I want to have another CSS that applies to an input type, so how do I do this? Creating a class won’t work here because it will just be ignored because of this first one.

Use case:

I have 5 text input that I want to style x way and I have 3 text input that I want to style y way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:41:52+00:00Added an answer on May 25, 2026 at 1:41 pm

    Use the attribute selector, supported by IE7+, and every other modern browser..

    If you want, say, text inputs, use this:

    input[type="text"] {
        color: red; /* Or whatever */
    }
    

    Inputs of type password would be like this, for example:

    input[type="password"] {
        color: blue; /* Or whatever */
    }
    

    And so on. It’s not used that often, but should be, to use other attributes and even custom ones. This quirksmode page gives good examples.


    Here is one of my own:

    <div foo="bar"></div>
    
    /* Any `div` element with `foo` having any value */
    div[foo]
    {
        background: red;
    }
    
    /* Any `div` element with `foo` having a specific value (bar) */
    div[foo="bar"]
    {
        background: green;
    }
    

    If we’re applying this to text inputs, you can use their name attribute:

    <input type="text" name="username">
    <input type="text" name="email">
    
    input[name="username"]
    {
        background: blue;
    }
    
    input[name="email"]
    {
        background: green;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have some markup like this: <html> <head> <style type=text/css> #container {
Lets say I have an array like this: string [] Filelist = ... I
Lets say we have something like: <div class=row> <div class=box> <a class=more href=#more/> </div>
Lets say we have a <div style=width:100px;>This text is too long to fit</div> The
I have a small question concerning css styles and javascript / jquery. Lets say
Let's say I have cleaner like this .cleaner:after { content: '.'; display: block; clear:
Let's say I have some text as follows: do this, do that, then this,
One more question about the sticky footer css... lets say i have the following
Let's say I have: <div> hello <div>hello</div> </div> I'd like the two texts to
Let's say we have defined a CSS class that is being applied to various

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.