.list > li:nth-of-type(1) {background-color: violet;}
.list>li:first-of-type {background-color: green;}
.list > li:nth-of-type(8) {background-color: violet;}
.list>li:last-of-type {background-color: yellow;}
.list>li:nth-last-of-type(4) {background-color: red;}
层级:>,空格平级:+,~
.list> :nth-of-type(n+3) {background-color: green;}
计算过程:
.list> :nth-of-type(-n+3) {background-color: green;}
计算过程:
等效于
.list> :nth-of-type(odd) {background-color: lightgreen;}
计算过程:
.list> :nth-of-type(2n -1) {background-color: lightgreen;}
.list> :nth-of-type(even) {background-color: lightgreen;}
相关推荐
© 2020 asciim码
人生就是一场修行