Center list-elements horizontally independent of amount of elements - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Horizontal

Description

Center list-elements horizontally independent of amount of elements

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 {<!--   www  .ja va  2  s .co  m-->
   width:100%;
   background-color:Chartreuse;
   text-align:center;
}

li {
   list-style:none;
   display:inline-block;
   padding:2em;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li>Lorem </li> 
   <li>Lorem </li> 
   <li>Lorem </li> 
   <li>Lorem </li> 
  </ul> 
  <ul> 
   <li>Lorem </li> 
   <li>Lorem </li> 
   <li>Lorem </li> 
   <li>Lorem </li> 
   <li>Lorem </li> 
  </ul>  
 </body>
</html>

Related Tutorials