Use nth-child(odd) on table rows - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Row

Description

Use nth-child(odd) on table rows

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
table tr.trclass:nth-child(odd) {
   color:Chartreuse;
}

table tr.trclass:nth-child(9n + 9) {
   color:yellow;
}
</style> <!--from ww  w. j av  a  2  s .  c o m-->
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass exempt"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass exempt"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass exempt"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
    <tr class="trclass"> 
     <td>L</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials