DEV Community

Discussion on: Image aspect ratio done right 😍

Collapse
 
yashints profile image
Yaser Adel Mehraban

Solution one is basically adding height:auto; to the image tag and setting the proper aspect ratio. Say the ratio was 800x600 if you set that right, the image will gets resized by its parent correctly, plus the fact that on load browser will calculate how much height it should reserve for the image and render other elements while its loading