HTML CSS examples for CSS Widget:Table Column
Alternating Color HTML Table
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .TFtableCol {<!--from w w w . j av a2 s. c om--> width:100%; border-collapse:collapse; } .TFtableCol td { padding:8px; border:2px solid Chartreuse; } .TFtableCol tr { background:yellow; } .TFtableCol tr td:nth-child(odd) { background:blue; } .TFtableCol tr td:nth-child(even) { background:pink; } </style> </head> <body> <table class="TFtableCol"> <tbody> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> </tbody> </table> </body> </html>