Html Css Resize Image Aspect Ratio. Since a percentage of image width and height is specified the browser can resize nearly any image and maintain its aspect ratio. To override any already present height attribute on the image.
Two common video aspect ratios are 4 3 and 16 9. What is aspect ratio. If the screen gets smaller it turns into this.
In order to maintain the aspect ratio of a div with css create flexible elements that keep their aspect ratio 4 3 16 9 etc when resize the browser window.
Is it possible to use pure css and the flex box layout to let the images. But a slight problem happened and the image goes out of proportions. To preserve the aspect ratio all you need to do is set the height and width css properties as shown myselector width. I ve used the css flex box layout which appears as shown below.