I have encountered an issue with Firefox that if border-box is applied to an image, a gap is created on the right side.
<div id="sl">
<img class="der" src="https://www.google.com/logos/2012/francois_truffaut-2012-hp.jpg"/>
</div>
#sl
{
background-color: #ff0;
display: inline-block;
}
body
{
background-color: #f00;
}
.der
{
height: 60px;
display: block;
border: 1px solid #00f;
-moz-box-sizing: border-box;
}
Firefox only: http://jsfiddle.net/r2GLU/
The question is why is this behavior? I guess that border-box shouldn’t have been applied on image in the first place, but I don’t think that it is forbidden either and Firefox is the only one who has problems.
I think you’ve encountered a bug in Firefox. The original, un-resized image is 163px high by 421px long.
Now, looking at the computed styles in Firebug, the
imghas these values (I’ve added comments showing how they were computed):And the div has these values:
The bug is that last computation. It should have been: