第n个孩子交替2行 [英] nth-child to alternate by 2 rows
本文介绍了第n个孩子交替2行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用CSS3的 nth-child
选择器在背景颜色两行之间交替,而不是通常的一行使用 nth-
I want to use CSS3's nth-child
selector to alternate between background color two rows thick, rather than the usual one row when using nth-child(odd)
.
所以我们有一个表:
ROW 1: Blue
ROW 2: Blue
ROW 3: Red
ROW 4: Red
ROW 5: Blue
ROW 6: Blue
推荐答案
tr {
background: blue;
}
tr:nth-child(4n+1), tr:nth-child(4n+2) {
background: red;
}
从0开始。
n
will count from 0 and up.
这篇关于第n个孩子交替2行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文