2ppzbw
Last Updated: March 08, 2016
·
2.052K
· andreia

Zebra table using only CSS3

tr:nth-child(2n+1){ background: ‪#fff‬ } 
tr:nth-child(2n+0){ background: ‪#ffffec‬ }

4 Responses
Add your response

1808

I believe you can also use :nth-chilld(even) and :nth-child(odd). :)

over 1 year ago ·
4207

You don't need two nth-child selectors, just give the default style to the original tr element. If you want to do every other row starting with the second, 2n or even is sufficient.

over 1 year ago ·
5740

This doesn't work.

over 1 year ago ·
5741

This doesn't work.

over 1 year ago ·