get equal spacing between <li>s styled with float:left; in a responsive-width div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

get equal spacing between <li>s styled with float:left; in a responsive-width div

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">
#myDiv {<!--from w  w  w.  j av a 2  s. co m-->
   width:51%;
   margin:0;
   overflow:auto;
}

#myDiv ul {
   padding:6px;
   margin:0 0 0 0;
   height:auto;
   background:red;
   text-align:center;
   font-size:14px;
}

#myDiv li {
   list-style-type:none;
   display:inline-block;
   background-color:Chartreuse;
   margin:0 3px;
}
</style> 
 </head> 
 <body> 
  <div id="myDiv"> 
   <nav> 
    <div> 
     <ul> 
      <li> <a href="foo">Lorem </a> </li> 
      <li> <a href="foo">Lorem ip</a> </li> 
      <li> <a href="foo">Lo</a> </li> 
      <li> <a href="foo">Lorem ipsum dolo</a> </li> 
     </ul> 
    </div> 
   </nav> 
  </div>  
 </body>
</html>

Related Tutorials