Background-image size

by 3 replies
4
I have an image that I want to use for a background, which is 800x600. Is there a way to have this expand to fit the size of the users browser?

I see in the CSS3 stuff you can change the size, but I have tried and am not sure I am using the right code!

Any help?Thanks
#website design #backgroundimage #size
  • Assuming the background image is "constant" (ie won't look bad if repeated), you could try this...

    div#background
    {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:url(background_image.png);
    }
    • [1] reply
    • that will not stetch the background image.
      it will stretch the div containing the bg but the bg itself will still be tiled.


      coykiesaol
      I'm not familiar with CSS3 stuff so I don't know if that will work. You can try using a div layer with brandon's positioning and a z-index:0; that contains an <img width="100%" height="100%">
      • [1] reply

Next Topics on Trending Feed

  • 4

    I have an image that I want to use for a background, which is 800x600. Is there a way to have this expand to fit the size of the users browser? I see in the CSS3 stuff you can change the size, but I have tried and am not sure I am using the right code!