下定决心还是再学一遍CSS等前端知识
1. 结构伪类
1.1 nth-child
- 奇数
nth-child(2n+1)
- 偶数
nth-child(2n)
- 前几个
nth-child(-n+5)
1.2 nth-last-child
nth-last-child(1)- 倒数第一个
nth-last-child(-n+2)- 最后2个
1.3 nth-of-type
- 和
nth-child类似,但是这个计数的时候只计算同种类的元素
1.4 nth-last-of-type
1.5 其他
:first-child:last-child:first-of-type:last-of-type:only-child:only-of-type:root:empty- 里面完全空白的元素
1.6 否定伪类
:not(), 格式是:not(x)- x是简单选择器