HTML img scaling

Posted by rwallace on Stack Overflow See other posts from Stack Overflow or by rwallace
Published on 2009-08-28T15:18:45Z Indexed on 2010/05/08 10:38 UTC
Read the original article Hit count: 189

I'm trying to display some large images with HTML img tags. At the moment they go off the edge of the screen; how can I scale them to stay within the browser window?

Or in the likely event that this is not possible, is it possible to at least say "display this image at 50% of its normal width and height"?

The width and height attributes distort the image -- as far as I can tell, this is because they refer to whatever attributes the container may end up with, which will be unrelated to the image. I can't specify pixels because I have to deal with a large collection of images each with a different pixel size. Max-width doesn't work.

© Stack Overflow or respective owner

Related posts about html

Related posts about web-development