Select first Descendant with CSS - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element parent child

Description

Select first Descendant with CSS

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>Lorem i</title> 
  <style>
.container .example {<!--   w  ww. ja v a 2 s. co m-->
   border:2px solid Chartreuse;
}

.container-fixed ul>:first-child {
   border:2px solid yellow;
}

.container {
   margin-bottom:31px;
}

* {
   margin:6px;
   padding:6px;
   list-style-type:none;
}
</style> 
 </head> 
 <body translate="no"> 
  <div class="container"> 
   <ul> 
    <li class="example"> <p class="example">Lorem ipsum dolor sit </p> </li> 
    <li class="example"> <p class="example">Lorem ipsum dolor sit </p> </li> 
   </ul> 
  </div> 
  <div class="container-fixed"> 
   <ul> 
    <li class="example"> <p class="example">Lorem ipsum dol</p> </li> 
    <li class="example"> <p class="example">Lorem ipsum dol</p> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials