View Full Version : resize an image

01-14-2003, 05:43 PM
if I use a <img> tag I can resize the image with width and height but how can I resize the image if I use it as a background of <td>
such as: <td style="background-image: url(myimage.gif);">

01-14-2003, 05:51 PM
you cant.

you could take a look at this page (http://www.javascriptkit.com/dhtmltutors/cssreference.shtml#2) to see what CSS can do to a background though...

01-14-2003, 06:05 PM
OK, Thank you

01-14-2003, 08:41 PM
no problem. sorry i couldnt come up with a somewhat more productive answer ;) you never know... someone might have discovered something i've never known.

01-15-2003, 10:30 AM

it's not a great idea anyway to have the browser resize an image using width and/or height; if the image is reduced in size this way, it still has to be loaded in its original size, creating unnecessary download effort, and the algorithm used by the browser in question may not produce the best result. Having the browser enlarge an image does reduce download effort, but may also result in an ugly picture (there are cases in which this effect can be deliberately used, but with caution).
Best solution is to use images with the desired size. To my knowledge, there's no way in CSS to resize an image used as background, anyway.