Image Keep Aspect Ratio Html. For example let s say you want a block to have initially 300px width and 150px height and if. But by setting the height and width attributes of an img tag to 64 it s not maintaining the aspect ratio so the image looks.
What is aspect ratio. Cover was not working in ie and it was taking 100 width and 100 height and aspect ratio was distorted. Aligning the photo in the vertical center or bottom would get ugly with the photo in the img.
Just don t forget to set the sizes on the css since divs don t have the width height attribute on the tag itself.
The end result is an image that scales up or down perfectly. But the problem was object fit. If the images are not resized keeping the aspect ration and you show me an image which does keep the aspect ratio of the pixels i have to assume you are trying to accomplish the aspect ratio of the cropping area the inner of the green wile keeping the aspect ratio of the pixels. Cover helps you achieve the task of maintaining the aspect ratio while positioning an image inside a div.