风起临冬
2018-08-08 12:40
.wrapper > div:nth-of-type(2n+1),
.wrapper > p:nth-of-type(2n){
background: orange;
}
/*或者*/
.wrapper > div:nth-first-child(4n+1),
.wrapper > p:nth-of-type(2n){
background: orange;
}
/*或者*/
.wrapper > div:nth-last-child(2n+1),
.wrapper > p:nth-of-type(even){
background: orange;
}
:nth-last-child(2n+1)这个没有效果吧?
感觉应该是nth-child(4n+1) ? 不是nth-first-child(4n+1)?
我觉得,nth-of-type(2n+1)、odd、(2n-1)根本只算一种方法。把前面的知识都用进去才是作者的本意。
十天精通CSS3
243146 学习 · 2677 问题
相似问题