Do a conditional nth-child - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Do a conditional nth-child

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">
ul>li {
   color:Chartreuse;
}

ul>li[attrName="active"]~li {
   color:yellow;
}
</style> <!--from   w  w w .j a va 2  s  . c om-->
 </head> 
 <body> 
  <ul> 
   <li>Lorem</li> 
   <li>Lorem</li> 
   <li attrname="active">Lorem</li> 
   <li>Lorem</li> 
   <li>Lorem</li> 
  </ul>  
 </body>
</html>

Related Tutorials