css3新属性的技巧

1.奇偶属性:

/*奇数*/

ul li:nth-child(odd){

background-color: green;

}

/*偶数*/

ul li:nth-child(even){

background-color: red;

}

2.大于某个数的选择器

li大于1的li元素的变成红色

ul li:nth-child(n+2){
background-color:red;}

li大于2的li元素的变成绿色

ul li:nth-child(n+3){
background-color:green;}
3.
 

 

posted @ 2019-09-06 14:06  星雨,恒奋斗,过客  阅读(125)  评论(0编辑  收藏  举报