Friday, June 1, 2012

ASP.NET/CSS - How to keep images aspect ratio

Uploaded images have different aspect ratios. That's the CSS way to avoid image stretching - constant width this example (change the values or set the width auto, height some value to keep the height constant). Simply add this to the img CSS:



.img_resize
{
    width:100px;
    height:auto;
}



Cheers!

No comments:

Post a Comment