CSS Selectors - Determining even/odd children starting with last child - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element parent child

Description

CSS Selectors - Determining even/odd children starting with last child

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">
tr:nth-last-of-type(even) {
   background-color:Chartreuse;
}
</style> <!--from  ww w .j a v a 2s.co m-->
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>Lorem ips</td> 
    </tr> 
   </tbody> 
  </table> 
  <br> 
  <table> 
   <tbody> 
    <tr> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>Lorem ips</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials