In theory, it is as simple as tr:nth-child(even) { background: #999; } tr:nth-child(even) { background: #999; } However, nth-child support is not surprising and will only work with the latest browsers.
An example :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>Test</title> <style type="text/css"> thead, tr:nth-child(even) { background: #aaa; } </style> </head> <body> <table> <thead> <tr><th>Header</th><th>Header</th></tr> </thead> <tr><td>Data</td><td>Data</td></tr> <tr><td>Data</td><td>Data</td></tr> <tr><td>Data</td><td>Data</td></tr> </table> </body> </html>
source share