Internet Explorer - Flexbox Image Ratio

后端 未结 2 1381
耶瑟儿~
耶瑟儿~ 2021-02-08 07:23

The following fiddle shows image ratio correctly in Chrome / Firefox.

However in Internet Explorer the images (which should be square) retain their original height in

2条回答
  •  梦毁少年i
    2021-02-08 08:23

    The reason for this is a known documented bug where IE10 and IE11 didn't always preserve intrinsic ratios. And the reason it works in IE10 as per @gaynorvader's comment is that the default value for 'flex' in IE10 was 0 0 auto rather that the final spec's 0 1 auto. Which means that in IE10, your image is seen as flex-grow: 0 as further explained at flexbug 6

    The fix here is to set your image as flex: none; as per: http://jsfiddle.net/hexalys/knyagjk5/12/, or add an additional container around it. But I'd advise on not making images flex items at all if you don't really need to. In this case, your article container is already a flex-item so I don't think you need to make another nested flex item out of the .details class . That seems unnecessary.

提交回复
热议问题