Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2006, 08:52 PM   PM User | #1
ImperialSpider
Regular Coder

 
Join Date: Jan 2004
Location: San Antonio, TX
Posts: 131
Thanks: 1
Thanked 0 Times in 0 Posts
ImperialSpider is an unknown quantity at this point
need help with background image sizing

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...

Code:
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
ImperialSpider is offline   Reply With Quote
Old 10-13-2006, 11:31 PM   PM User | #2
Kravvitz
Senior Coder

 
Join Date: Feb 2006
Location: USA
Posts: 1,013
Thanks: 0
Thanked 0 Times in 0 Posts
Kravvitz is an unknown quantity at this point
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?
Code:
if (document.all||document.getElementById)
Why not use this?
Code:
if (document.body && document.body.style)
__________________
Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
Java != JavaScript && JScript != JavaScript
Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.
Kravvitz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:53 AM.


Advertisement
Log in to turn off these ads.