All of the image files have dimensions > 300px by 300px, so I would expect them to follow the CSS rules. However, as you can see from the photo below, the second image doesn't follow the rules (it's taller than it is wide). As an fyi, the actual dimensions of that image file are 934px x 1401px.
Any help would be appreciated! Thanks.
解决方案
You want to set the dimensions of your container, then have the image inside expand to fill it. I'd reshuffle it like this:
This will of course apply to all images, so you might want to either add a class for the images inside img-bar or set the dimensions for your figure element containing the main image.
这篇关于img 不考虑 html 中的宽度(使用 flexbox)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!