Answers for "object-fit: contain;' does not preserve the aspect ratio of the image; it stretches the image to cover the entire width and height of the container."

CSS
9

css image fit in div with aspect ratio

img {
    width: 100%;
    height: 100%; 
    object-fit: contain;
}
Posted by: Guest on July-02-2020

Code answers related to "object-fit: contain;' does not preserve the aspect ratio of the image; it stretches the image to cover the entire width and height of the container."

Browse Popular Code Answers by Language