css伪类选择器
点击查看代码
:nth-child(){},用来选择父元素下的第n个子元素。
注意::nth-child(){}是根据父元素下所有子元素进行排序
:nth-child(2n){},选中父元素下偶数行的子元素。
:nth-child(2n+1){},选中父元素下奇数行的子元素。
:nth-child(odd){},选中父元素下奇数行的子元素。
:nth-child(even){},选中父元素下偶数行的子元素。
:first-of-type{},用来选择父元素下的第一个子元素。
注意::first-of-type{}是根据父元素下所有同类型的子元素进行排序。
:last-of-type{},用来选择父元素下的最后一个子元素。
注意::last-of-type{}是根据父元素下所有同类型的子元素进行排序。
:nth-of-type(n){},用来选择父元素下的第n个子元素。
注意::nth-of-stype(n){}是根据父元素下同类型的子元素进行排序
:nth-of-type(2n){},选中父元素下偶数行的子元素。
:nth-of-type(even){},选中父元素下偶数行的子元素
:nth-of-type(2n+1){},选中父元素下奇数行的子元素。
:nth-of-type(odd){},选中父元素下奇数行的子元素。
:not(n){}否定类,将复合的元素去除,n为指定数值。
本文来自博客园,作者:jialiangzai,转载请注明原文链接:https://www.cnblogs.com/zsnhweb/p/17854889.html

浙公网安备 33010602011771号