Css selectors : finding the last sibling of a type - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element sibling

Description

Css selectors : finding the last sibling of a type

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">
.foo + h2, .foo + h2 + h2 {<!--from   w  ww .j  a  va  2s  .  co  m-->
   background:red;
}
</style> 
 </head> 
 <body> 
  <h1>Lorem i</h1> 
  <h2>Lorem</h2> 
  <h1 class="foo">Lorem i</h1> 
  <h2>Lorem</h2> 
  <h2>Lorem</h2> 
  <h1>L</h1> 
  <h2>Lorem</h2>  
 </body>
</html>

Related Tutorials