``` li{
color: blue;
}
```body li{
color: blue;
}
.list{
color: blue;
}
(0,1,1)
.list li{
color: blue;
}
(0,1,2)
body.list li{color: blue;}
#cla{color: blue;}
#cla .list{color: blue;}
#cla .list li{color: blue;}
body #cla .list li{color: blue;}
a=(0,1,2,3,….) n=(0,1,2,3,….) b=移动的位置 a*n+b
.list :first-of-type{color: brown;}
.list :last-of-type{color: red;}
.list{color: red;}
匹配一组的前后几个
代码:
-n+3=
-1*0+3=0+3=3
-1*1+3=-1+3=2
-1*2+3=-2+3=1
.list :nth-of-type(-n+3){color: red;}
* 匹配一组的后四个(算法)
.list :nth-last-of-type(-n+4){color: blue;}
匹配单数
.list :nth-of-type(odd){color:burlywood;}
.list :nth-of-type(even){color:burlywood;}
代码:.list :nth-of-type(4){color:deeppink;}
在元素前插入内容
.list :before{content: "我在这里---";color: red;}
.list :after{content: "---我在这里";color: red;}
相关推荐
© 2020 asciim码
人生就是一场修行