批改状态:合格
老师批语:
id: 百位
class: 十位
tag: 个位
如:
body h1 {color: violet;}
它的id为0,class为0,tag为2。所以它的权重就是 : 0,0,2
!important: 是最高指示,忽略任何权重
h1 {color: chartreuse !important;}
:nth-of-type(an+b)

.list> :nth-of-type(-n + 3) {background-color: lightgreen;}
/ -10 + 3 = 3
-11 + 3 = 3-1 = 2
-12 + 3 = 3-2 = 1
-1*3+3 = 3-3 = 0
[3,2,1] */
.list> :nth-of-type(odd) {background-color: lightgreen;}.list> :nth-of-type(even) {background-color: lightgreen;}
odd为奇数, even为偶数。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号