Horizontally centering li inside ul - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Horizontal

Description

Horizontally centering li inside ul

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">
ul.nav {<!--  ww w .ja  v  a  2s .c o m-->
   width:801px;
   margin:0 auto;
   list-style-type:none;
   text-align:center;
   padding-left:0;
}

.nav li {
   display:inline-block;
   width:301px;
   border:2px solid Chartreuse;
}
</style> 
 </head> 
 <body> 
  <ul class="nav"> 
   <li>Lorem ipsum d</li> 
   <li>Lorem ipsum dolor</li> 
   <li>Lorem ipsum dol</li> 
   <li>Lorem ipsum dolo</li> 
  </ul>  
 </body>
</html>

Related Tutorials