CSS selector: :nth-of-type(2) - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-of-type

Description

CSS selector: :nth-of-type(2)

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolo</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div.pair:nth-of-type(2) {
   color:Chartreuse;
   background:yellow;
}

div.pair:nth-of-type(3) {
   color:blue;
   background:pink;
}
</style> <!--from w  ww.  ja  va2 s  .  c o  m-->
 </head> 
 <body> 
  <div class="h2 colors">
    Lorem ipsum dol 
  </div> 
  <div class="pair">
    Lorem ipsum d 
  </div> 
  <div class="pair">
    Lorem ipsum d 
  </div> 
  <div class="pair">
    Lorem ipsum d 
  </div> 
  <div class="pair">
    Lorem ipsum d 
  </div>  
 </body>
</html>

Related Tutorials