Navbar item aligned from left - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav Bar Item

Description

Navbar item aligned from left

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   www  .j a  v a2s.  c om-->
   width:100%;
   float:left;
   margin:0 0 4em 0;
   padding:0;
   list-style:none;
   background-color:Chartreuse;
}

#nav li {
   float:left;
}

#nav li a {
   display:block;
   padding:9px 16px;
   text-decoration:none;
   font-weight:bold;
   color:yellow;
   cursor:pointer;
   -webkit-transition:background-color 2s, color 2s;
   -moz-transition:background-color 2s, color 2s;
   -ms-transition:background-color 2s, color 2s;
   -o-transition:background-color 2s, color 2s;
}

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

#nav li ul {
   display:none;
}

#nav li:hover ul {
   display:block;
   position:absolute;
   margin:0;
   list-style:none;
   padding:0;
}

#nav li:hover li {
   float:none;
}

#nav li:hover li a {
   background-color:OrangeRed;
   color:grey;
   display:block;
}

#nav li li a:hover {
   background-color:BlueViolet;
   color:Chartreuse;
}
</style> 
 </head> 
 <body> 
  <ul id="nav"> 
   <li> <a>Lore</a> </li> 
   <li> <a>Lorem ipsum</a> 
    <ul> 
     <li> <a>Lorem ipsum do</a> </li> 
     <li> <a>Lorem ipsum</a> </li> 
     <li> <a>Lorem ipsum dolo</a> </li> 
    </ul> </li> 
  </ul>  
 </body>
</html>

Related Tutorials