Resize image proportionally with CSS?

370    Asked by AmyAvery in Data Science , Asked on Jul 18, 2021

Is there a way to resize (scale down) images proportionally using ONLY CSS?

I'm doing the JavaScript way, but just trying to see if this is possible with CSS. How CSS scale image proportionally?

Answered by Asistha pandey

In CSS, you can use the code given below to resize the image proportionally:

img.resize {
    width:540px; /* you can use % */
    height: auto;
}

Your Answer

Interviews

Parent Categories