Center Nav Bar with hover state - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover

Description

Center Nav Bar with hover state

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">
#primary_nav_wrap {<!--from   w w  w .  j  ava 2s  .  com-->
   display:table;
   margin:0 auto;
   margin:16px auto 0 auto;
}

#primary_nav_wrap ul {
   display:table-cell;
   list-style:none;
   position:relative;
   padding:0;
}

#primary_nav_wrap ul a {
   display:block;
   color:Chartreuse;
   text-decoration:none;
   font-weight:701;
   font-size:14px;
   line-height:33px;
   padding:0 16px;
   font-family:"HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif
}

#primary_nav_wrap ul li {
   position:relative;
   float:left;
   margin-right:auto;
   margin-left:auto;
   padding:0
}

#primary_nav_wrap ul li.current-menu-item {
   background:yellow;
}

#primary_nav_wrap ul li:hover {
   background:blue;
}

#primary_nav_wrap ul ul {
   display:none;
   position:absolute;
   top:100%;
   left:0;
   background:pink;
   padding:0
}

#primary_nav_wrap ul ul li {
   float:none;
   width:201px
}
</style> 
 </head> 
 <body> 
  <div id="nav"> 
   <nav id="primary_nav_wrap"> 
    <ul> 
     <li class="current-menu-item"> <a href="#">Lore</a> </li> 
     <li> <a href="#">Lorem</a> </li> 
     <li> <a href="#">Lorem </a> 
      <ul> 
       <li> <a href="#">Lore</a> </li> 
       <li> <a href="#">Lorem ip</a> </li> 
       <li> <a href="#">Lorem ip</a> </li> 
       <li> <a href="#">Lorem ipsum</a> </li> 
       <li> <a href="#"></a> </li> 
      </ul> </li> 
     <li> <a href="#">Lorem ip</a> </li> 
     <li> <a href="#">Lorem </a> </li> 
     <li> <a href="#">Lorem ips</a> </li> 
     <li> <a href="#">Lorem ipsum do</a> 
      <ul> 
       <li> <a href="#">Lorem ipsu</a> </li> 
       <li> <a href="#">Lorem ipsum dolor </a> </li> 
      </ul> </li> 
     <li> <a href="#">Lorem ipsum </a> </li> 
     <li> <a href="#">Lorem</a> </li> 
    </ul> 
   </nav> 
  </div>  
 </body>
</html>

Related Tutorials