phaedrus10
11-04-2010, 01:29 PM
Ok. I have a web site I am working on and it is done in a two-column layout with a header across both columns at the top, a lefthand menu sidebar and a righthand division for the main content. I have a background image that I would like to show behind the main content only. I would like it to be fixed (not scroll with the content).
The problem is - when I do not fix the background, it centers on the correct division. When I do add the "fixed" code to the CSS, it jumps to positioning on the body. I would like the background to remain centered (horizontally) with the content division and allow the content to scroll over it... I would like it to remain centered (horizontally) when a user resizes their browser and not move out from under the content division.
I have tried center top, percentages and absolute positions for the background-position.
In other words - I want a background for a specific division only, but I would like it "fixed" and it won't work.
My code looks like this:
#middle_column { float:left; width:75%; margin:0px 20px; color:#660000; font-size:16px; text-align:justify; }
.post { background:url(../images/dove_25.gif) no-repeat center top fixed; margin-bottom:35px; line-height:18px; }
.post_body { padding:5px 15px; }
The problem is - when I do not fix the background, it centers on the correct division. When I do add the "fixed" code to the CSS, it jumps to positioning on the body. I would like the background to remain centered (horizontally) with the content division and allow the content to scroll over it... I would like it to remain centered (horizontally) when a user resizes their browser and not move out from under the content division.
I have tried center top, percentages and absolute positions for the background-position.
In other words - I want a background for a specific division only, but I would like it "fixed" and it won't work.
My code looks like this:
#middle_column { float:left; width:75%; margin:0px 20px; color:#660000; font-size:16px; text-align:justify; }
.post { background:url(../images/dove_25.gif) no-repeat center top fixed; margin-bottom:35px; line-height:18px; }
.post_body { padding:5px 15px; }