View Full Version : How do you make the backgorund in your Div Layers fixed?


nme88
06-29-2004, 01:13 AM
I have tried adding the fixed tag after the background code, but that just seems to make the background disappear from the div layer completely! Please help! :ateddy:

salomeyasobko
06-29-2004, 01:14 AM
well you can use CSS

<DIV id="DIV">

and for the CSS:

<style type="text/css">
#DIV {background-image: url(your-background-filename); background-position: fixed;}
</style>

nme88
06-29-2004, 01:23 AM
ok, thanks for that! :)

salomeyasobko
06-29-2004, 01:27 AM
you're welcome :)

EDIT: oops i messed it up!!

it should be:

background-attachment: fixed

not

background-position: fixed

sorry! glad i caught that, though ;)

nme88
06-29-2004, 01:34 AM
Sorry, but it's not working. :( I used the following code:

<div id=DIV style="width:520; height:378; padding:5px; border: none 2px solid; overflow:auto"><style type="text/css">
#DIV {background-image: url(http://img25.imageshack.us/img25/9638/TyranniaJungle.jpg); background-position: fixed;}
</style>

But, it still didn't fix the background. To see what I'm talking about, take a look at my page at:

http://home.neopets.com/templates/homepage.phtml?pet_name=Nomiree88

It is the first scrollbox! :confused:

nme88
06-29-2004, 01:36 AM
Oh, that explains it. Thanks!

salomeyasobko
06-29-2004, 01:37 AM
oh the CSS goes after the <head> tag of your coding.

it's:

<html>
<head>
<title>whatever</title>
<style type="text/css">
#DIV {background-image: url(your-background-filename); background-position: fixed;}
</style>
</head>

i probably should've mentioned that before, sorry! :)

also, put quotation marks around the DIV ID.. like this:

<DIV ID="DIV">