Resizing images proportionally

23rd Apr, 2009 | css

I needed to resize images proportionally for a site and found the answer far more simple than I expected…

Some instances I needed a specific height, other times a specific width. How to do it? PHP graphics library? Javascript hack? Noooooo…it's far easier than that with CSS:

If you need to specify the height set the width to auto. Vice versa for width.

Why can't all CSS be this simple! It even works in IE6….