Hover submenu alignment on the menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Hover

Description

Hover submenu alignment on the menu

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">
nav {<!--from   ww  w . j  a  v  a 2s  .c o  m-->
   width:100%;
   margin:0;
   overflow:hidden;
}

nav ul {
   list-style:none;
   overflow:hidden;
   -webkit-transition:max-height 0.5s;
   -ms-transition:max-height 0.5s;
   -moz-transition:max-height 0.5s;
   -o-transition:max-height 0.5s;
   transition:max-height 0.5s;
}

nav li {
   float:left;
}

nav li a {
   background:Chartreuse;
   border-right:2px solid yellow;
   color:blue;
   display:block;
   font:17px, Arial, Helvetica;
   padding:13px;
   text-align:center;
   text-decoration:none;
}

nav li a:hover, nav li.active a {
   background:pink;
}

.handle {
   width:100%
   background: black;
   text-align:left;
   box-sizing:border-box;
   padding:16px 11px;
   cursor:pointer;
   color:OrangeRed;
   display:none;
}

nav li ul {
   display:none;
   width:11em;
   background-color:grey;
}

nav li:hover ul {
   display:block;
   position:absolute;
   margin:0;
   padding:0;
}

nav li:hover li {
   float:left;
}

nav li:hover li a {
   background-color:BlueViolet;
   border-bottom:2px solid Chartreuse;
   color:yellow;
   width:100px;
}

nav li li a:hover {
   background-color:blue;
}

@media only screen  and (max-width:580px) {
   nav ul {
      max-height:0;
   }
   
   .showing {
      max-height:21em;
   }
   
   nav li a {
      box-sizing:border-box;
      width:100%;
      font:14px Arial,Helvetica;
      padding-top:13px;
      padding-bottom:13px;
      border:solid pink;
      text-align:left;
   }
   
   .handle {
      display:block;
      background-color:OrangeRed;
   }

}
</style> 
 </head> 
 <body> 
  <nav> 
   <ul> 
    <li> <a href="index.php">Lorem</a> </li> 
    <li> <a href="#">Lorem ips</a> 
     <ul> 
      <li> <a href="">Lorem ipsum dolor</a> </li> 
      <li> <a href="">Lorem ipsum </a> </li> 
      <li> <a href="">Lorem ipsum do</a> </li> 
      <li> <a href="">Lorem ipsu</a> </li> 
     </ul> </li> 
    <li> <a href="googlemap.php">Lorem ip</a> </li> 
    <li> <a href="careers.php">Lorem </a> </li> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="login.php">Lorem </a> </li> 
   </ul> 
   <div class="handle">
     Lorem 
   </div> 
  </nav>  
 </body>
</html>

Related Tutorials