Reputation: 12520
I can use the following to select all divs that are not the first div among their siblings.
div:not(:nth-of-type(1))
Is there anyway I can select all div's that are not the first two?
Upvotes: 0
Views: 3042
Reputation: 585
It can even be dome more clear, without specifically writing out the not pseudo selector per element.
U can do this the get the same results:
:not(:nth-of-type(-n+2)) {
}
:not(:nth-child(-n+2)) {
}
I know its a late answer:P but maybe still usefull to somebody
Upvotes: 1
Reputation: 8521
You can use multiple :not
to exclude multiple items
Example
div:not(:nth-child(1)):not(:nth-child(2)) {
background: blue;
}
Upvotes: 1
Reputation: 16831
You can use sequential :not
pseudos, so: div:not(:nth-of-type(1)):not(:nth-of-type(2))
OR
Even better, you can use sibilings selectors... Like div:condition ~ div
that will select every sibiling divs that are after the one with the condition.
So: div:nth-of-type(2) ~ div
will select every div that comes after the second child.
http://jsfiddle.net/akm4qnds/1/
Upvotes: 2