Resize image proportionally with CSS?

codingbear picture codingbear · Apr 25, 2009 · Viewed 1.5M times · Source

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.

Answer

Mkk picture Mkk · Apr 26, 2010

To resize the image proportionally using CSS:

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