Style even number child - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Style even number 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">
article:nth-child(even) .text {<!-- w w  w  . ja v a  2 s  .  c o m-->
   background-color:Chartreuse;
}
</style> 
 </head> 
 <body> 
  <article class="tweet-inner"> 
   <div class="text-wrapper"> 
    <div class="tweet"> 
     <div class="text"> 
      <p>Coming down! my</p> 
     </div> 
    </div> 
   </div> 
  </article> 
  <article class="tweet-inner"> 
   <div class="text-wrapper"> 
    <div class="tweet"> 
     <div class="text"> 
      <p>Coming down! my</p> 
     </div> 
    </div> 
   </div> 
  </article> 
  <article class="tweet-inner"> 
   <div class="text-wrapper"> 
    <div class="tweet"> 
     <div class="text"> 
      <p>Coming down! my</p> 
     </div> 
    </div> 
   </div> 
  </article>  
 </body>
</html>

Related Tutorials