I want a preferably CSS-only technique for getting an ol
to flow into two columns if it is longer than the height of the container. The number of items in the list may vary and the height of the container may change.
When I try setting the li to width:50%
and float:left
it goes in two columns but 2 goes beside 1 instead of below it.
what I want to achieve is this:
This will work for modern browsers (i.e not IE) using the column-count
and column-gap
rules :
fiddle
ol#two-columns {
-moz-column-count: 2;
-moz-column-gap: 20px;
-webkit-column-count: 2;
-webkit-column-gap: 20px;
column-count: 2;
column-gap: 20px;
}
The cross-browser option would be:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With