CSS3 nth-of-type combined with a class - HTML CSS CSS Selector

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

Description

CSS3 nth-of-type combined with a class

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">
.j-v-section-wrapper {<!--from  w ww .jav a 2  s  .c  o  m-->
   height:100px;
}

div.j-l-page-wrapper div.j-v-section-wrapper:nth-of-type(even) {
   background-color:Chartreuse;
}

div.j-l-page-wrapper div.j-v-section-wrapper:nth-of-type(odd) {
   background-color:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="j-l-page-wrapper"> 
   <div class="j-v-section-wrapper"></div> 
   <span class="something-else"></span> 
   <div class="j-v-section-wrapper"></div> 
   <div class="j-v-section-wrapper"></div> 
   <div class="j-v-section-wrapper"></div> 
   <span class="something-else"></span> 
  </div>  
 </body>
</html>

Related Tutorials