override parent :nth-of-type in child element - HTML CSS CSS Selector

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

Description

override parent :nth-of-type in 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">
.base-slider {<!--  w  w w.ja  v  a2  s. com-->
   width:100%;
}

.base-slider .ui-state-default {
   border:none;
}

.base-slider .ui-state-default:nth-of-type(1) {
   background:gold;
}

.base-slider .ui-state-default:nth-of-type(2) {
   background:red;
}

.base-slider.secondary-slider .ui-state-default {
   background:green;
}
</style> 
 </head> 
 <body> 
  <div id="slider" class="base-slider secondary-slider"> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
   <a href="#" class="ui-state-default">L</a> 
  </div>  
 </body>
</html>

Related Tutorials