Selecting the last general sibling - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element sibling

Description

Selecting the last general sibling

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">
.head {<!-- w  w  w  . j a va  2  s . c  om-->
   font-weight:801;
}

.head~.sub:last-of-type {
   border-bottom:2px solid Chartreuse;
}
</style> 
 </head> 
 <body> 
  <div class="head">
    Lorem 
  </div> 
  <div class="sub">
    Lorem ip 
  </div> 
  <div class="sub">
    Lorem ip 
  </div> 
  <div class="sub">
    Lorem ip 
  </div> 
  <div class="head">
    Lorem 
  </div> 
  <div class="sub">
    Lorem ip 
  </div>  
 </body>
</html>

Related Tutorials