Combining CSS pseudo-classes nth-child and not - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Combining CSS pseudo-classes nth-child and not

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:first-child, tr:nth-child(2n+4)
 {
   background-color:Chartreuse;
}
</style> <!-- w w  w  .jav a  2  s  . com-->
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
    <tr class="openingTimes"> 
     <td>Lorem ipsum dolor</td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials