Changing parent when hover on child - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover to change

Description

Changing parent when hover on child

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.menu li {
   display:inline-block;
   margin:4px;
   padding:6px;
   vertical-align:top;
}

ul.menu li:hover {
   font-weight:bold;
   background-color:Chartreuse;
}

ul.menu, ul.menu li:hover ul, ul.menu li:hover ul.menu li {
   font-weight:normal;
   background-color:yellow;
}

ul.menu li:hover ul.menu li:hover {
   font-weight:bold;
   background-color:blue;
}
</style> <!--   www.  j a  v  a  2 s  .  c om-->
 </head> 
 <body> 
  <ul class="menu"> 
   <li class="first leaf"> <a href="#" title="" class="active">Lore</a> </li> 
   <li class="expanded"> <a href="#" title="Products">Lorem ip</a> 
    <ul class="menu"> 
     <li class="first leaf"> <a href="#">Lorem ips</a> </li> 
     <li class="leaf"> <a href="#">Lorem ips</a> </li> 
     <li class="leaf"> <a href="#">Lorem ips</a> </li> 
     <li class="last leaf"> <a href="#">Lorem ips</a> </li> 
    </ul> </li> 
  </ul>  
 </body>
</html>

Related Tutorials