Internet Explorer - Flexbox Image Ratio

后端 未结 2 1410
耶瑟儿~
耶瑟儿~ 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条回答
  •  耶瑟儿~
    2021-02-08 08:05

    Add one bit of CSS:

    img {
      min-height: 1px;
    }
    

    http://jsfiddle.net/mblase75/3Lb5f8pe/

    Honestly, I wish I knew why this works. In light of hexalys' answer, I suppose this forces IE to recalculate the height/width ratios. (In any event, I applied this to my own code just now where the affected element is a label instead of an image; it worked there, too.)

提交回复
热议问题