Closed Bug 214034 Opened 21 years ago Closed 21 years ago

fixed backgroud in div affixed incorrectly

Categories

(Core :: Layout, defect)

x86
FreeBSD
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 165149

People

(Reporter: kmag, Unassigned)

Details

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.1; FreeBSD 4.7-RELEASE; X11; i386; en_US)
Build Identifier: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4b) Gecko/20030716 Mozilla Firebird/0.6

When you fix a background to block objects in css, they are fixed to the page instead 
of the object. In my example, it is a div. The background displays at the top of the page 
instead of the top of the div. I wanted my background to be affixed to the div so I tried 
setting it to scroll. I have it set to no repeat and when I scrolled the div the background 
moved with the scroll while leaving a copy affixed to the page behind it. 

Reproducible: Always

Steps to Reproduce:
1. Create a div with a style sheet element. 
2. To the element, add overflow: auto; position: absolute; top: 150px; and 
background-image: url(myimage.jpg); 
3. Find some way to make the page and the div scroll (eg. make the div height larger 
than your y resolution and fill the div with more carriage returns than that height can 
display.) 
4. add to the style sheet backround-attachment: fixed; 
5. scroll the div's bar and the pages. 
6. change attachment in 4. to scroll and repeat step five. 
Actual Results:  
In fixed mode the image is attached to the page and ignores the boundries of the div. 
When you scroll the div it doesnt move, but it doesn't when you move the page either. 
When the scroll element is used, the background scrolls with the page and with the div, 
as it should, but when the div scrolls, it leaves a copy of itself behind (as if on another 
layer fixed to the div). 

Expected Results:  
The background image should have been affixed to the div instead of the page with 
the attachment set to fixed. With it set to scroll, it should scroll with the page and the 
div but not leave a copy of itself behind. I can theorize that it is because it displays it as 
if it is scrolling with the page and with the div separately (this whole bug is hard to 
explain, sorry...) but I don't have time to search through code to check. 

 have tried this in WinXP NS 6, Firebird .6 & Mozilla 1.3 as well as FreeBSD Firebird .6 
from two weeks ago and Mozilla 1.4 from 2 days ago. It displays the same in all of 
them.
> When you fix a background to block objects in css, they are fixed to the page
> instead  of the object. 

That's the definition of "background-attachment: fixed".  See
http://www.w3.org/TR/CSS2/colors.html#propdef-background-attachment and
http://www.w3.org/TR/CSS21/colors.html#propdef-background-attachment (the latter
clarifies things a little bit).

> when I scrolled the div the background moved with the scroll while leaving a
> copy affixed to the page behind it. 

That's bug 165149 



*** This bug has been marked as a duplicate of 165149 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
guess I should report the bug to ms then... their  "browser" affixes it to the div. and 
here i thought microsoft had done right for once... just goes to prove that old axiom 
"Microsoft sucks and should never be trusted or relied on." Anyway... the scrolling bug 
was said to have been fixed over a year ago but a gecko build two days old still shows 
symptoms. Granted this is still a duplicate, but that one is not fixed. 
> their  "browser" affixes it to the div

Yep.  Known bug in IE.  :(

And yes, bug 165149 is very much not fixed yet; see the discussion there for the
ins and outs of the nastiness that happens when determining what the correct
behavior should be....
You need to log in before you can comment on or make changes to this bug.