属性选择器
E[att^=“val”]:选择E元素定义了att属性,并且开头是val的元素 a[class^="col"]
E[att$="val"]:选择E元素定义了att属性,并且以val为结尾的E元素a[title$="jpg"]
E[att*="val"]:选择E元素定义了att属性,并且属性值任意位置包含val的E元素a[class*="a"]
伪类选择器
:root:根选择器,在HTML文档中,根元素始终是html 。
:not:否定选择器
:empty: 选择器表示空,用来选择没有任何内容的元素(包括空格也没有)
:target: 目标选择器,用来匹配文档的url的某个标识符的目标元素,可以有多个target
:first-child :注意,这边是反思路,看例子
(它属于某个元素的第一个子元素,选中)
:last-child :反之,最后一个
:nth-child(n):https://www.imooc.com/code/739
:nth-last-child(n):https://www.imooc.com/code/740
:first-of-type:这里概念很绕口,解释链接https://www.cnblogs.com/xuan52rock/p/4416228.html
:nth-of-type(n):https://www.imooc.com/code/810
:last-of-type:https://www.imooc.com/code/811
:nth-last-of-type(n):https://www.imooc.com/code/812
only-child选择器
选择的是父元素中只有一个子元素
only-pf-type: