|
Posted by Jukka K. Korpela on February 13, 2007, 12:47 am
Please log in for more thread options
Scripsit finecur:
> I have a <img scr="mypic.jpg"> in my html.
You should fix the markup then (at least by adding an alt attribute).
> I would like to display the
> image by width=200 if the image width is larger than 200. I also would
> like to display the image by its real width if the image width is
> smaller than 200. How can I do it?
Although you can do that as others have replied, using the max-width
propertym though not for IE 6 or older, it's almost always a wrong idea to
do such things via markup or style sheets. The image should be converted to
a suitable size on the server or before it is uploaded onto the server, for
two basic reasons:
1) More efficient - it's foolish to transfer a large image and then have it
shrinked, losing much of its quality that required so many bytes.
2) Better quality - browsers aren't really good image processing software.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
|