Highlight entire line in a nested list on hover - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover on list

Description

Highlight entire line in a nested list on hover

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">
ul, li {
   margin:0;
   padding:0
}

ul li span {
   display:block
}

ul li span:hover {
   background:orange
}

li span {
   padding-left:3em
}

li li span {
   padding-left:5em
}

li li li span {
   padding-left:7em
}
</style> <!--from   w  w w .  j av a2  s.c  o m-->
 </head> 
 <body> 
  <ul> 
   <li> <span>Lorem</span> </li> 
   <li> <span>Lorem</span> 
    <ul> 
     <li> <span>Lorem ipsum d</span> </li> 
     <li> <span>Lorem ips</span> 
      <ul> 
       <li> <span>Lorem ipsum dol</span> </li> 
      </ul> </li> 
    </ul> </li> 
  </ul>  
 </body>
</html>

Related Tutorials