CSS force image resize and keep aspect ratio

前端 未结 23 887
野趣味
野趣味 2020-11-22 10:04

I am working with images, and I ran across a problem with aspect ratios.

\"\"

23条回答
  •  心在旅途
    2020-11-22 10:38

    This is mental. Use the scale-down property - it explains itself.

    Inline styling:

    
    

    This will stop flex from stretching it. In this case, the image would go to 50% of the width of its parent container and the height would scale down to match.

    Keep it simple.

提交回复
热议问题