结构选择器
:nth-child(n)第几个元素 从1开始设置
:nth-child(2n)偶数元素 从0开始设置
:nth-child(2n+1) 奇数元素
:nth-of-type(n) 某个元素下同种类型中的第几个子元素
:first-child -> nth-child(1)
:first-of-type->nth-of-type(1)
:last-child
:last-of-type
:only-child仅有一个子元素
:only-of-type 同种类型的子元素只有一个
:empty 满足条件的
否定选择器
:not()
属性选择器
E[attr=val]
E[attr|=val] 只能等于val 或只能以val-开头
E[attr*=val] 包含val字符串
E[attr~=val] 属性值有多个,其中一个是val
E[attr^=val] 以val开头
E[attr$=val] 以val结尾
目标伪类选择器
:target 用来匹配url指向的目标元素
存在url指向该匹配元素时,样式效果才会生效
伪元素
:first-line 匹配第一行文本
:first-letter 匹配第一首字符
:before 和 after DOM元素前后插入额外的内容
