views:

56

answers:

1

I'm trying to create an image object or canvas object that will resize based on the window dimensions, but keep the aspect ratio. Is this possible?

I know that with canvas, you can maintain bicubic scaling, but is it possible to have the image scale on the window resize while maintaining the aspect ratio?

+2  A: 

You might want to give this a shot:

http://css-tricks.com/how-to-resizeable-background-image/

Jimmy
I ran into this same situation. I wanted to have images resize their width but have the height stay proportional so it is not all distorted. I ended up simply assigning the width="100%" and not assigning any height at all.
exoboy
Using width:100%; height:auto; works fine until the browser is resized vertically so that there's leftover blank space. I want something more like what the google homepage has (if you assign a background). It resizes making sure there's overflow in the smaller dimension.