Notes to self

Easy solutions to tricky problems
May 09
Permalink

Anoying floats pixel gap in IE

It’s a well documented bug, but I’ll recap here anyway. If you have a some floats next to each other, and there’s a little extra gap underneith one of the floats in IE, any IE will do this, it’s probably because you have floated an inline element. E.g. an image.

Someone at CSS Creator described this better: Because images are inline replaced elements, browsers leave a space below the line box for the descenders of text characters, e.g. g, j, y etc. By making the image display: block you’re telling the browser that it’s not text anymore and so no need to leave room for the descenders.