CSS3 selector question for all but first select
Solution 1:
See: http://jsfiddle.net/uDvEt/1/
.options > div:not(:first-child) select { background:yellow;}
Solution 2:
You need to select the option div
s instead of the select
s when using :not(:first-child)
, because every select
is the first (and only) child of its parent div
:
div.options > div:not(:first-child) > select
An alternative to :not(:first-child)
is to use :nth-child()
with a starting offset of 2, like this:
div.options > div:nth-child(n + 2) > select
Another alternative is with the general sibling combinator ~
(which is supported by IE7+):
div.options > div ~ div > select
Solution 3:
.options > div:nth-child(n+2) select