Select the 5th child element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Select the 5th child element

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">
p:nth-child(n+6)<!--from  w  w w  . jav  a2s. co  m-->
 {
   background:Chartreuse;
}
</style> 
 </head> 
 <body> 
  <h1>Lorem ipsum dolor</h1> 
  <p>Lorem ipsum dolor si</p> 
  <p>Lorem ipsum dolor sit</p> 
  <p>Lorem ipsum dolor si</p> 
  <p>Lorem ipsum dolor sit</p> 
  <p>Lorem ipsum dolor si</p> 
  <p>Lorem ipsum dolor si</p> 
  <p>Lorem ipsum dolor sit </p> 
  <p>Lorem ipsum dolor si</p> 
  <p>Lorem ipsum dolor si</p> 
  <p> <b>Lorem</b>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie </p>  
 </body>
</html>

Related Tutorials