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)
.
The "Result" section of this jsFiddle illustrates what I want.
So we would have a table:
ROW 1: Blue
ROW 2: Blue
ROW 3: Red
ROW 4: Red
ROW 5: Blue
ROW 6: Blue
You can use this:
tr {
background: blue;
}
tr:nth-child(4n+1), tr:nth-child(4n+2) {
background: red;
}
n
will count from 0 and up.
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With