
/* 千:id百:class个:tag *//* 调试模式 提权到最高*/p{color:orange !important;}/* 单个id 1,0,0 */#helloid{color: seagreen;}/* class+标签 0,1,2*/body p.hello{color: salmon;}/* 单个class 0,1,0 */.hello{color: blueviolet;}/* 多个标签 0,0,2*/body p{color: red;}/* 单个标签 0,0,1*/p{color: blue;}

/* 第一个 */.list>:first-of-type {background-color: green;}/* 最后一个 */.list>li:last-of-type {background-color: sienna;}/* 第n个 */.list>:nth-of-type(6){background-color: rgb(10, 43, 72);}/* 倒数第n个 */.list>li:nth-last-of-type(4) {background-color: violet;}
格式::nth-of-type(an+b)

.list> :nth-of-type(0n + 3) {background-color: lightgreen;}

.list> :nth-of-type(n + 3) {background-color: lightgreen;}/* 取前3个 */.list> :nth-of-type(-n + 3) {background-color: lightgreen;}/* 取最后3个 */.list> :nth-last-of-type(-n + 3) {background-color: lightgreen;}/*奇数*/.list> :nth-of-type(2n - 1) {background-color: lightgreen;}/*奇数语法糖*/.list> :nth-of-type(odd) {background-color: lightgreen;}/*偶数*/.list> :nth-of-type(2n) {background-color: lightgreen;}/*偶数语法糖*/.list> :nth-of-type(even) {background-color: lightgreen;}
相关推荐
© 2020 asciim码
人生就是一场修行