using background-attachment fixed on div doesn't place image relative of top left corner of div




15 years ago
15 years ago


(Reporter: wvaniersel, Assigned: roc)


Windows 2000

Firefox Tracking Flags

(Not tracked)





15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113

In the example page you can see what happens. The left block goes wrong in
1.5final and 1.6final. The right shows how it should be displayed. But this is
done by using a workaround. I found this workaround today when I was confronted
by the problem while working on a website.

I have also included a screendump just in case it's only a problem on the PC

Now let me try to explain where it seems to go wrong...

I have created a <div> with a class leftmenu, in the stylesheet definition I
have set the following: 
    background-attachment: fixed;
    background-image: url(images/fixed-background-250x250.gif);
    left: 50px;
    top: 50px;

what should happen is that the image is placed in the background of the <div> at
50px, 50px of the viewport and 0px 0px from the <div>. But what happens instead
the image is placed at 0px, 0px from the viewport and -50px, -50px from the
<div>. When I remove the background-attachment the background image starts
scrolling but I want it to be fixed.

I have looked to see if this bug was already reported but I couldn't find it...
so I hope I look good enough else I'm really sorry about entering a double bugreport

Reproducible: Always
Steps to Reproduce:
1. Look at example page, url include in this bug

Actual Results:  
Look at left item on example page

Expected Results:  
Look at left right on example page

Comment 1

15 years ago

That is the correct behavior. Internet Explorer, you could have known, has a bug.
Last Resolved: 15 years ago
Resolution: --- → INVALID

Comment 2

15 years ago
> If a background image is specified, this property specifies whether it is
> fixed with regard to the viewport ('fixed') or scrolls along with the 
> containing block ('scroll').

> [...]

> Even if the image is fixed, it is still only visible when it is in the
> content, padding or border area of the element. Thus, unless the image is
> tiled ('background-repeat: repeat'), it may be invisible.

Comment 3

15 years ago
If I get it right the W3C mean viewport with the canvas?

W3C CSS 1 says: "If a background image is specified, the value of
'background-attachment' determines if it is fixed with regard to the canvas or
if it scrolls along with the content."

I thought the canvas was the area within the block (<div> in this case)

Why in gods name do people use Internet Explorer???? ;)
CSS1 was wrong.
You need to log in before you can comment on or make changes to this bug.