Select the last article inside of a section if it is odd - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:id

Description

Select the last article inside of a section if it is odd

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:last-child:nth-child(odd) {<!--from www . ja  v  a 2 s . c o  m-->
   color:Chartreuse;
}
</style> 
 </head> 
 <body>
   Lorem ipsum dolo 
  <section> 
   <article>
     Lor 
   </article> 
   <article>
     Lor 
   </article> 
   <article>
     Lor 
   </article> 
  </section>Lorem ipsum dolor 
  <section> 
   <article>
     Lor 
   </article> 
   <article>
     Lor 
   </article> 
   <article>
     Lor 
   </article> 
   <article>
     Lor 
   </article> 
  </section>  
 </body>
</html>

Related Tutorials