When I change my website to
<!DOCTYPE HTML>
Every img element that is wrapped inside a DIV has a 3px bottom margin to it even though that margin is not defined in CSS. In other words, there are no style attributes that are causing that 3px bottom margin.
<div class="placeholder">
<img alt="" src="/haha.jpg" />
</div>
Now let’s say haha.jpg is 50×50, and .placeholder is set to display: table. Strangely the height dimensions of .placeholder in my observation is 50×53…
Has anyone encountered this anomaly before and fixed it?
EDIT
Here is the JS FIDDLE
This problem is caused by the image behaving like a character of text (and so leaving a space below it where the hanging part of a “y” or “g” would go), and is solved by using the
vertical-alignCSS property to indicate that no such space is needed. Almost any value ofvertical-alignwill do; I’m fond ofmiddle, personally.jsFiddle: http://jsfiddle.net/fRpK6/1/