View Full Version : need help with background image sizing

10-12-2006, 09:52 PM
I am trying to create a website that has a fixed background image (which is an animated gif). I am currently using the following code to put the image in the center of the webpage...

if (document.all||document.getElementById)
document.body.style.background url('lightning.GIF') blue stretch center no-repeat fixed"

but this is only allowing a fixed size of the gif. How do I enlarge (resize) the background image in the website? it is currently only showing a 120px by 150px image. I would like the image to be around 300px by 320 px and centered on the webpage.

I have tried to enter the height="300px" width="300px" everywhere I can think of in the above code, but it does not work. Am I doing something wrong, or do I need to place a new code elsewhere in the webpage? Or is it just not possible without resizing the gif image itself? Someone please help me with this.

Thank you,
Imperial Spider

10-14-2006, 12:31 AM
CSS2 does not provide a method of specifying the dimensions of a background image.

I suggest you use an image editor to resize the image.

There is no "stretch" keyword for backgrounds in CSS2.

Why are you using this?

if (document.all||document.getElementById)
Why not use this?

if (document.body && document.body.style)