The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS li adding unecessary space Re: li adding unecessary space


@Gingerbread, [Here’s a pen]( “”) showing different techniques. In each case I used the dimensions you gave above. The font-size used is going to vary depending on the font you specify (I left default san-serif).

The first is just a replica of your image. The reason for the spaces is that a float will not render higher than a previous float – so the long list items are creating the spaces.

The second shows two lists with an equal number of list items. But because the li are of different length, you’ll wind up with different length lists. This assumes that the lists are dynamic – if you’re hard coding them, you could alter the number of items each list has.

The third is a simple single full width list – might be the best option. It would need a slightly smaller font-size to fit everything however.

Note that in the future, or now if you want to use browser prefixes, you could use css columns to achieve your orginal desired look. The fourth example shows this (with prefixes)