I'm trying to spread a list of <li>
's aligned horizontally using float:left
across my <ul>
.
Does anyone have any idea how this is done?
I'm trying to spread a list of <li>
's aligned horizontally using float:left
across my <ul>
.
Does anyone have any idea how this is done?
Float left and divide the width of the
ul
over de number ofli
s I think is what you are after. Have a look here: http://jsfiddle.net/b2nsW/HTML:
CSS:
You can use
display: inline-block;
it works in modern browsers.Example: http://jsfiddle.net/joar/ELpDD/
As feela said in the comments to #7131346,
The answer is to use
display: table;
on the<ul>
element anddisplay: table-cell;
on the<li>
elements.Then adjust the padding or margins of the li elements to spread them across less or more across the ul.
Is there some reason why you can't just set them to
display: inline;
(orinline-block
)? For example:http://jsfiddle.net/TKmR5/