In CSS is there a selector for referencing a specific input type that also has a class?

CssCss Selectors

Css Problem Overview


Basically I want a CSS selector that grabs all input[type="text"] but that also has a class "some-class".

Both of the following don't seem to be working for me:

input[type="text"] .some-class {}    /* doesn't work */

.some-class input[type="text"] {}    /* doesn't work */

I'm sure I'm missing something simple here. Thanks in advance.

Css Solutions


Solution 1 - Css

You want input.some-class[type="text"]

.some-class input looks for input tags that are descendants of .some-class.

input.some-class does the reverse.

Solution 2 - Css

    input[type="text"].some-class {
    ....
     } 

with no space between "input[type="text"]" and ".some-class" will work..

input[type="text"]-space in between is the problem-.some-class {}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionArt GeigelView Question on Stackoverflow
Solution 1 - Csswless1View Answer on Stackoverflow
Solution 2 - CssHasteqView Answer on Stackoverflow