Auto Resize Image in CSS FlexBox Layout and keeping Aspect Ratio?

后端 未结 8 837
长情又很酷
长情又很酷 2020-12-12 12:34

I\'ve used the CSS flex box layout which appears as shown below:

\"enter

If t

8条回答
  •  自闭症患者
    2020-12-12 12:58

    I suggest looking into background-size options to adjust the image size.

    Instead of having the image in the page if you have it set as a background image you can set:

    background-size: contain

    or

    background-size: cover

    These options take into account both the height and width when scaling the image. This will work in IE9 and all other recent browsers.

提交回复
热议问题