Css selector : parent and child element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element parent child

Description

Css selector : parent and 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">
li:first-child {<!--   w w  w  . jav a2 s  .  c om-->
   color:Chartreuse;
}

li:last-child {
   color:yellow;
}
</style> 
 </head> 
 <body> 
  <ul id="parent"> 
   <li>Lorem ipsum dol</li> 
   <li>Lorem ipsum dolo</li> 
   <li>Lorem ipsum dol</li> 
  </ul>  
 </body>
</html>

Related Tutorials