HTML CSS examples for CSS Widget:Table Row
CSS nth Selectors table rows
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> table.special tr:nth-child(odd) td { background-color:Chartreuse; } </style> <!-- w w w . ja v a 2s . c om--> </head> <body> <table class="special"> <tbody> <tr class="r0"> <td>Lorem ipsum</td> </tr> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> <tr class="r0"> <td>Lorem ipsum</td> </tr> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> <tr class="r0"> <td>Lorem ipsum</td> </tr> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> </tbody> </table> <table> <tbody> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> <tr class="r0"> <td>Lorem ipsum dol</td> </tr> <tr class="r1"> <td>Lorem ipsum dol</td> </tr> </tbody> </table> </body> </html>