1. css样式权重计算
256进制
!important
无穷大
行间样式style
1000
#id
100
.class
|属性|伪类 10
标签|伪元素 1
通配符 0
3. 常用类选择器
3.1 a:first-child
说明:选中父元素的第一个子元素,且该子元素必须是a
元素
3.2 a:first-of-type
说明:选中子元素中的第一个a
元素
3.3 a:last-child
说明:选中父元素的最后一个子元素,且该子元素必须是a
元素
3.4 a:last-of-type
说明:选中子元素中的最后一个a
元素
3.5 a:nth-child(3)
说明:选中指定的第3个元素,且必须是a
元素
3.6 a:nth-of-type(3)
说明:选中子元素中的第3个a
元素
3.7 p::first-letter
说明:选中元素中的第一个字母或文字
3.8 p::first-line
说明:选中元素中的第一行文字
3.9 p::selection
说明:选中用户框选的文字