Spread CSS <li> horizontally through <ul>
5 answers
Swim left and divide the width of ul by the number li I think this is what you need. Take a look here: http://jsfiddle.net/b2nsW/
HTML:
<ul> <li>item</li> <li>item</li> <li>item</li> <li>item</li> </ul> CSS
ul { width: 250px; background: red; padding: 0; margin: 0; overflow: auto; } li { width: 20%; float: left; background: green; margin: 2.5%; } +1
You can use display: inline-block; It works in modern browsers.
Example: http://jsfiddle.net/joar/ELpDD/
As stated in the comments on # 7131346 ,
[...] "inconvenient space between elements" is caused not by reinstalling fields and gaskets ...
+1