Art Geigel Art Geigel - 1 year ago 72
CSS Question

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

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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download