div
to take up only as much space as its contents require. Normally, this is trivial to do with the float
property.Unfortunately, in IE the
div
was still trying to take up 100% of the available space.The problem was that the
div
had a few child div
s with their height
property set. This erroneously caused those div
s to expand their width, which expanded the parent as well.My solution was to switch from
height
to font-size
and line-height
to get the height I wanted in the child elements. To adapt this for Firefox I needed to put a single non-breaking space in each child div
.