Code Snippet Submit one! Home » Code Snippets » CSS » CSS3 Zebra Striping a TableCSS3 Zebra Striping a Tabletbody tr:nth-child(odd) { background-color: #ccc; }
great certainly saved me some time searching
this didn’t work well for me, but the PHP one worked great.
CSS3 zebra striping is better solution! Why? Here is the right concept:
1. PHP generates html as output, which should not care how the elements looks like.
2. CSS purpose is to “care” how the elements looks like.
Cant understand, how it works…
@Dyllon and @Artem, here is a simple demo explaining how to use this code, and a live example of it being used.
http://webdesignandsuch.com/2010/08/add-zebra-striping-to-a-table-with-css3/
Sadly… not supported by IE
Can be done with jQuery addClass.
shitty explorer not supported
I bet these people saying that it isn’t working are browsers that are not supported. :D
I meant, *using* browsers that are not supported.
Just wanted to say thanks for all of the cool tips and tricks. I’ve used the css zebra stripe trick before but it hadn’t occurred to me to prefix my css with tbody so that I could better target hovers and such.