1, :nth-of-type(n) 匹配屬於父元素的特定類型的第N個子元素spa
匹配結果:3d
2, :nth-last-of-type(n),匹配其父元素下的第N個特定類型的子元素,從後往前code
知足條件:1,必須是特定類型 2,從後往前的第N個blog
3,:first-of-type io
4, :last-of-type 匹配其父元素下的最後一個特定類型的子元素ast
body div:last-of-type 知足條件,body下的全部DIV元素,最後一個DIVclass
5, :only-of-type 選擇其父元素上的惟一一個相同類型的子元素im
6, :empty() 空選擇器margin
7, :not() 否認選擇器db
<nav> <a href="#">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a> <a href="#">5</a> </nav>
*{ margin:0; padding:0; } nav{ margin:0 auto; width:530px; font-size:0; } a{ text-decoration: none; display: inline-block; width:100px; height:30px; line-height:30px; text-align: center; font-size:14px; margin-left:5px; } nav > a:not(:last-of-type){ border-right:1px solid red; }