The current approach our site is using to break a single list into multiple columns is to use multiple ul
s:
<ul>
<li>one</li>
<li>two</li>
</ul>
<ul>
<li>three</li>
<li>four</li>
</ul>
This doesn't seem ideal to me, since semantically, it's not two lists, it's one. I've seen a lot of inadequate solutions for multi-columns lists. I'm looking for a solution that:
Uses the following markup structure
<ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ul>
Organizes like this:
one three two four
Not this:
one two three four
Works without modification if list-length changes, or if items wrap multiple lines.
- Uses valid, semantic HTML.
- Works down to IE8.
The ideal solution is CSS only, but I'm open to using jQuery UI or light-weight Javascript.
(PS, here's my CSS attempt, with notable problems.)
Edit: This question is specific to semantic lists. The other supposedly "duplicate" question is regarding <div>
elements, which is a different ballgame because additional markup is allowed. No additional markup is allowed between a <ul>
and an <li>
. This question is focused on semantics which means there is an emphasis on using HTML to indicate with as much detail as possible the meaning of the content.
one two
on row one andthree four
on row two rather than the intendedone three
andtwo four
– CharacterizationDIV
s are a whole different ballgame. You don't have the semantic limitations that you have in lists. Multi-column lists are a specific issue, in fact, alistapart has an entire article on the topic. – AdonicDIV
s, there are some fairly simple solutions involving adding extra markup. Doing that within a list would create invalid HTML. – Adonic