css3选择器nth-of-type,:nth-last-of-type,:first-of-type,:last-of-type,:only-of-type

1, :nth-of-type(n) 匹配属于父元素的特定类型的第N个子元素

匹配结果:

2, :nth-last-of-type(n),匹配其父元素下的第N个特定类型的子元素,从后往前

满足条件:1,必须是特定类型    2,从后往前的第N个

3,:first-of-type 

4,  :last-of-type 匹配其父元素下的最后一个特定类型的子元素

         body div:last-of-type 满足条件,body下的所有DIV元素,最后一个DIV

5, :only-of-type 选择其父元素上的唯一一个相同类型的子元素

猜你喜欢

转载自www.cnblogs.com/xubj/p/10148660.html