Functino

My daily struggle with webdevelopment

Tag: modulo

Zebra Tables: How to alternate table row colors

What is a “Zebra Table”? It’s a striped table with alternating row colors like this:
You can achieve this with very different approaches:
CSS only
With CSS 3 you can achieve such a table with the pseudo class nth-child. The rules are extremly simple and no additonal markup is required. Just add these lines to your CSS:

tr:nth-child(even) {background-color: [...]