Another Reason Why I Hate Internet Explorer

IE doesn’t respect your CSS height value of an empty div if it’s smaller than the non-existent text in the div. For example, if you have:

<div style="height:3px"></div>

the div could be 13px tall instead of 3. Two suggested fixes are:

  1. put an HTML comment in the div, or
  2. set the font-size and line-height to 1px and 0 respectively.

To give credit, I found the answer at 9mmfilm, which found Bruno’s suggestion.

Leave a Reply