Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    San Antonio, TX
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Senior Coder
    Join Date
    Feb 2006
    Thanked 0 Times in 0 Posts
    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)
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts