PDA

View Full Version : background-attachment not working at all


azoapes
04-15-2008, 01:14 PM
I'm trying to get the side decor images to stay fixed when the page is scrolled down. When I change the CSS properties of div#mainleft the image disappears!? Doesn't show at all, I tried setting background-repeat: no-repeat; and background-position: top left; but I can't get it to work... any ideas?

Here's the page:

http://klubbkalas.webbexperterna.se/

effpeetee
04-15-2008, 01:22 PM
possition:fixed; I think.:D

CSS
body {
background:white url(myimage.jpg) no-repeat 65% 70px fixed;}

http://bonrouge.com/~faq#fixedbg

worth a look

Frank

DakotaChick
04-15-2008, 05:48 PM
it is staying where you told it to stay, but the issue is that its not the page bg. If it was the page bg, the background-attachment:fixed; would work. Instead if chopping the 2 sides into separate image files, make it one large image file (saved as a gif if you can get away with it) and set it as the page bg with background-position:top center; background-attachment:fixed;


Edit: I'm not sure I made that clear to follow, so if it isnt, let me know...lol

azoapes
04-15-2008, 07:49 PM
Frank; no, background-attachment: fixed; is more accurate. Though you can define it in the background attribute for a shorthand... but that's not what I asked.

DakotaChick; I'd rather not create a 100 KB image to accomplish this, that's why I asked here... but maybe it's my only option.

Update: I tried out the large image variant and kinda liked it... what do you think? 60 KB too large a file?

DakotaChick
04-15-2008, 11:42 PM
seeing as its set in the css the user will only have to dl the file for the home page the first time they visit, then its cached from there on out unless you change something. 60kb might sound large but only one dl time to me sounds acceptable...others may disagree tho, i dont know.

Donkey
04-16-2008, 01:16 AM
In your CSS under body, try replacing


background-color: #000;
background-image: url(img/sides.gif);
background-position: top center;
background-repeat: repeat-y;

with

background: #000 url(img/sides.gif)repeat-y fixed top center;

It worked for me. Except in IE6 of course.