2014-08-28 33 views

回答

2

您可以使用順序:not假點,所以:div:not(:nth-of-type(1)):not(:nth-of-type(2))

http://jsfiddle.net/akm4qnds/

OR

更妙的是,你可以使用sibilings選擇...喜歡div:condition ~ div,將選擇每個sibiling的div在有條件的人之後。

因此:div:nth-of-type(2) ~ div將選擇第二個孩子之後的每個div。

http://jsfiddle.net/akm4qnds/1/

1

您可以使用多個:not排除多個項目

div:not(:nth-child(1)):not(:nth-child(2)) { 
    background: blue; 
} 

DEMO

0

它甚至可以是穹頂更加清晰,無覆蓋特別寫出每個元素的非僞選擇器。

U可以做到這一點,得到了相同的結果:

:not(:nth-of-type(-n+2)) { 

} 

:not(:nth-child(-n+2)) { 

} 

我知道它是一個遲到的回答:P但也許還是有用的給別人

相關問題