CodePen

HTML

            
              <div class="divname">
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
  <h2>Hello World</h2>
</div>
            
          
!

CSS

            
              .divname h2:nth-child(3) {
  color: blue; 
}

.divname h2:nth-child(even) {
  color: red;
}

.divname h2:nth-child(6) {
  font-style: italic; 
}
            
          
!

JS

            
              
            
          
!
999px
Loading ..................