如何按照以下顺序设置链接的样式:
第一红,第二蓝,第三蓝,第四红,第五红,第六蓝,第七蓝等等。
发布于 2013-12-16 17:42:24
我会这么做的。
li:nth-child(4n+1),
li:nth-child(4n+4) {
background-color: red;
}
li:nth-child(4n+2),
li:nth-child(4n+3) {
background-color: blue;
}
发布于 2013-12-16 17:43:46
div:nth-child(4n), div:nth-child(4n+1) { background: red; }
div:nth-child(4n+2), div:nth-child(4n+3) { background: blue; }
下面是jsFiddle演示:http://jsfiddle.net/WTRhz/
https://stackoverflow.com/questions/20617110
复制相似问题