This is due to a Subpixel Problem .
Each image occupies 50% of the container. For example, if the container has a width of 100 pixels, each image will have a width of 50 pixels.
But the width of the container may be an odd number of pixels, for example. 101px. Then there are three reasonable possibilities:
- Make one image 50px wide and the other 51px. Then the images will not be equally wide, even if you specify the same width for both of them.
- Make both images 50 pixels wide. Then there will be a gap of 1px
- Make both images 51 pixels wide. Then they do not fit, overflow the container or wrap it on the next line.
Each option has its drawbacks, but browsers currently prefer the first option. However, in this case, the images have an internal aspect ratio, so different widths will create different heights, and then a 1px gap is created horizontally, not vertically.
It seems that Firefox detects what, and thus makes the smaller image as tall as the other, violating the aspect ratio. Chrome prefers to use aspect ratio.
Unable to change this. It completely depends on the implementation:
The particularly strange part in all of this is that theres really no right, or wrong, here. As this behavior should the rendering mechanism is not determined by the CSS specification, having it remains until the implementation for rendering at its discretion.
source share