I thought I understood how the built-in and blocking elements work, but it left me alone. I found a fix for the problem, however I have no idea why this works .
For some reason, if you have img inside a div , the div looks like 3.5px above the image. However, if you set the image as a block element, this extra height will disappear.
Basic HTML:
<div id="wrapper"> <img src="http://www.basini.com/wp-content/uploads/2013/02/seeing-in-the-dark.jpg" width="300" height="230" /> </div>
And CSS:
#wrapper { background: orange; } #wrapper img { }
I installed jsfiddle to demonstrate the effect
Why is this happening and why does the "img" block element make this fix? Are there any other solutions?
source share