I'd like to lay out a list such as the following in 2/3 evenly spaced columns
<ul>
<li>one<li>
<li>two<li>
<li>three<li>
<li>four<li>
<li>five<li>
<li>six<li>
<li>seven<li>
<li>eight<li>
<li>nine<li>
</ul>
One solution is to separate the list into two lists and float one of them right, possibly with a margin, e.g.
<div id="col2">
<ul>
<li>one<li>
<li>two<li>
<li>three<li>
<li>four<li>
<li>five<li>
</ul>
</div>
<ul>
<li>six<li>
<li>seven<li>
<li>eight<li>
<li>nine<li>
</ul>
#col2 {
float: right;
margin-right: 450px;
}
This works OK, but has a number of shortcomings:
- (Un)semantic markup - it's not really 2 lists, I've split a single list into 2, just to make it easier to style
- The margin must be manually set to something that gives the appearance of being evenly spaced
- If the browser is made sufficiently narrow, the right-hand column will run into the second.
Is there a better way to do this, preferably without using a table?
Update:
I tried out Method 1, but I'm seeing some strange results. If you look at this 3-column list on you'll see there are 'holes' in the first 2 columns. Any idea why?