Use pseudo-class :not with :nth-child - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Use pseudo-class :not with :nth-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">
table tr td:not(:nth-child(2)):not(:nth-child(4)) {
   text-align:center;
}
</style> <!--from   w  w w.ja  v a  2 s.  c  om-->
 </head> 
 <body> 
  <table border="1" width="100%"> 
   <tbody> 
    <tr> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials