View Full Version : div background image stretch to fit div

07-12-2005, 06:23 PM
I have a div tag that holds images (for a image gallery)

After the 'next' button is selected the background image of the div tag is changed to the previous image and a new image is 'faded' overtop of it (give a nice fade effect)

the only problem is, when i set the new background image is does not 'fill' the div tag. instead it is scalled to fit (height, or width depending on the image dimensions)

does anyone know how to set a background image for a div tag and make it stretch to fit?

07-12-2005, 06:30 PM
You can't stretch a background image unfortunately, the only way would be to have a tiling image and repeat it using the 'repeat' property.

07-12-2005, 06:45 PM
Found a solution, just layer an image behind it and update that image :P

an example of what i'm doing can be found here (temporary link, will be taken down eventually)


take into consideration i just started this gallery. it's nothing specail right now.