Select complete <li> element in navigation bar when hovered or selected - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover on list

Description

Select complete <li> element in navigation bar when hovered or selected

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">
body {<!--from ww w  . j av a2  s.c o m-->
   color:Chartreuse;
}

nav {
   background-color:yellow;
   margin:11px 11px 0px 11px;
}

nav ul {
   margin:0px;
   list-style-type:none;
   padding:16px 0px 16px 0px;
}

nav ul li {
   display:inline;
   padding:6px 11px 6px 11px;
}

nav ul li a:link, nav ul li a:visited {
   color:blue;
   border-bottom:none;
   font-weight:bold;
   text-decoration:none;
}

nav ul li a:active {
   background-color:pink;
   text-decoration:none;
}

nav ul li:hover
 {
   background-color:OrangeRed;
   color:grey;
   padding:16px 11px 16px 11px;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <ul> 
    <li> <a href="index.html">Lore</a> </li> 
    <li> <a href="">Lorem ipsum </a> </li> 
    <li> <a href="">Lorem </a> </li> 
    <li> <a href="what_you_can_do.html">Lorem ipsum dol</a> </li> 
    <li> <a href="about.html">Lorem</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials