When my browser renders the following test case, there\'s a gap below the image. From my understanding of CSS, the bottom of the blue box should touch the bottom of the red
Remove the line break before the tag, so that it directly follows the tag with no blanks between it.
I don't know why, but for the Internet Explorer, this works.
font-size:0;
on the parent DIV is another tricky way to fix it.
display: block
in the image fixes it as well, but probably breaks it in other ways ;)
Because the image is inline it sits on the baseline. Try
vertical-align: bottom;
Alternately, in IE sometimes if you have whitespace around an image you get that. So if you remove all the whitespace between the div and img tags, that may resolve it.
Inline elements are vertically aligned to the baseline, not the very bottom of the containing box. This is because text needs a small amount of space underneath for descenders - the tails on letters like lowercase 'p'. So there is an imaginary line a short distance above the bottom, called the baseline, and inline elements are vertically aligned with it by default.
There's two ways of fixing this problem. You can either specify that the image should be vertically aligned to the bottom, or you can set it to be a block element, in which case it is no longer treated as a part of the text.
In addition to this, Internet Explorer has an HTML parsing bug that does not ignore trailing whitespace after a closing element, so removing this whitespace may be necessary if you are having problems with Internet Explorer compatibility.
line-height: 0;
on the parent DIV
fixes this for me. Presumably, this means the default line-height is not 0.