I want to center navigation bar in css - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav bar alignment

Description

I want to center navigation bar in css

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">
li:hover {<!--from   w w  w  .  j a  va  2  s. co  m-->
   font-size:121%
}

li:visited {
   color:Chartreuse;
}

ul#nav {
   text-align:center;
}

li {
   display:inline-block;
   margin:auto;
   list-style-type:none;
   font-family:Verdana;
   width:100px;
}

ul {
   list-style-type:none;
}

body {
   background-color:yellow;
}
</style> 
 </head> 
 <body> 
  <ul id="nav"> 
   <li> <a href="">Lore</a> </li> 
   <li> <a href="">Lore</a> </li> 
   <li> <a href="">Lorem i</a> </li> 
   <li> <a href="">Lorem</a> </li> 
   <li> <a href="">Lorem</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials