Centering a horizontal unordered list - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Horizontal

Description

Centering a horizontal unordered list

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 {<!--  ww  w  .j ava  2 s .  c  o m-->
   width:100%;
   margin:0 auto;
   background:Chartreuse;
}

nav ul {
   display:block;
   text-align:center;
}

nav ul li {
   display:inline-block;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <ul> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lore</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials