nth-child
nth-of-type
:not()
1.nth-child
1.在子元素上写
:nth-child(n) 选择器匹配属于其父元素的第 N 个子元素,不论元素的类型。
n 可以是数字、关键词或公式。
如:p:nth-child(1/2/3/odd/even/2n/2n+1/3n/)
image.png
该选择器是找当前元素的父元素下2n个子元素
2.在父元素上写
div+空格 匹配子元素上符合条件的元素
image.png
2.nth-of-type
1.必须是指定类型的
image.png
[图片上传中...(image.png-84f95-1541141836218-0)]
3.:not
image.png
image.png