Only select initiate child of parent using css - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element parent child

Description

Only select initiate child of parent using css

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

li {<!--   w ww  . j  a va 2  s  . com-->
   color:yellow;
}
</style> 
 </head> 
 <body> 
  <ul class="test"> 
   <li>L</li> 
   <li>Lor 
    <ul> 
     <li>Lorem ipsum dolor sit a</li> 
     <li>Lorem ipsum dolor sit a</li> 
    </ul> </li> 
   <li>L</li> 
  </ul>  
 </body>
</html>

Related Tutorials