Center navigation bar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav bar alignment

Description

Center navigation bar

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 {<!--  w  w w  .j  a  v a  2  s  .  c om-->
   margin:4px 0;
   width:701px;
}

nav ul {
   width:701px;
   height:auto;
   list-style:none;
}

nav ul li a {
   background:Chartreuse;
   font-family:'Open Sans', Arial, Helvetica, sans-serif;
   font-weight:301;
   font-size:19px;
   text-align:center;
   color:yellow;
   text-decoration:none;
   float:left;
   padding:9px 0;
   width:107px;
   margin:0px 11px 0 0;
}

nav ul li a:hover {
   background:blue;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <ul> 
    <li> <a href="../help.html">Lore</a> </li> 
    <li> <a href="instructions.html">Lorem</a> </li> 
    <li> <a href="instructions.html">Lorem</a> </li> 
    <li style="margin-right: 0px;"> <a href="legal.html">Lorem i</a> </li> 
    <li style="margin-right: 0px;"> <a href="legal.html">Lor</a> </li> 
    <li style="margin-right: 0px;"> <a href="legal.html">Lorem i</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials