fixed background-attachment in Netscape 7

F

Fredo Vincentis

I am trying to attach a background image to a <div> that has an
auto-overflow:

background-attachment: fixed;
overflow: auto;

This works fine in IE 5 and 6, but I have got difficulties with it in NN7.
It seems that, when the attachment is fixed, the image does not start at the
top left corner, but moves out of position (I only see the bottom half of
the image in my DIV).

Did anybody have this problem before and did you find a work around?

Thanks heaps!
 
B

brucie

in post: <
Fredo Vincentis said:
I am trying to attach a background image to a <div> that has an
auto-overflow:
background-attachment: fixed;
overflow: auto;
This works fine in IE 5 and 6, but I have got difficulties with it in NN7.

thats nice but its a bit useless telling us about it without a URL
demonstrating the issue especially when you don't specify which NS7.
NS7.1 is based on the 1.4 gecko which i don't have but there doesn't
seem to be an issue with the 1.6 gecko.
 
D

David Dorward

Fredo said:
I am trying to attach a background image to a <div> that has an
auto-overflow:

background-attachment: fixed;
overflow: auto;

This works fine in IE 5 and 6, but I have got difficulties with it in NN7.

Unlikely - it is more likely that it is doing what you want instead of what
you are telling it to do in IE.
It seems that, when the attachment is fixed, the image does not start at
the top left corner, but moves out of position (I only see the bottom half
of the image in my DIV).

background-attachment: fixed anchors the image to the _canvas_ instead of
the element.

http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html for a demo
(don't bother looking in IE).

I don't know how standards compliant browsers handle background images on
overflowing elements, but you could look at:

(1) Giving background-attachment fixed only to IE
(2) Putting the background image on a _parent_ to the element with the
overflow property set.
 
S

Steve Pugh

Fredo Vincentis said:
I am trying to attach a background image to a <div> that has an
auto-overflow:

background-attachment: fixed;
overflow: auto;

This works fine in IE 5 and 6, but I have got difficulties with it in NN7.
It seems that, when the attachment is fixed, the image does not start at the
top left corner, but moves out of position (I only see the bottom half of
the image in my DIV).

Have a look at
http://www.w3.org/TR/CSS21/colors.html#propdef-background-attachment
especially the part that says that the background is fixed with
respect to the viewport.

This means that if you have

<body>
<h1>heading</h1>
<div style="background: url(foo.png) fixed;">blah blah blah</div>
</body>

the image is fixed to the viewport and hence it's origin is located at
the origin of the viewport, not at the origin of the div. Hence only
the part of the image that extends down into the div will be visible.
IE gets this wrong, Gecko gets this right.

Steve
 
D

David Dorward

Whitecrest said:
But why demonstrate something that doesn't work in 80+% of the worlds
browsers? (EVEN if it is 100% standards correct)

css/edge is intended, first and foremost, to be as relentlessly creative
with CSS as we have been practical all these years. It does not exist to
present or explain safe cross-browser techniques; in fact, almost the
opposite. The goal here is to find ways to make CSS live up to its
fullest potential, with only minimal regard to browser limitations. For
all the time we've spent using CSS, most of us have barely scratched the
surface of the power CSS embodies, because we've been too caught up in
recreating old-style table-based design ideas and worried about support
limitations. No more. Now we start digging for treasure.

-- http://www.meyerweb.com/eric/css/edge/

Besides - in combination with hiding techniques it is possible to give a
very nice layout for web browsers and something simpler for IE.
 
B

brucie

in post: <
Whitecrest said:
But why demonstrate something that doesn't work in 80+% of the worlds
browsers?

so you can ask that question every time someone does something thats not
supported by a crappy three and a half year old browser.
 
W

Whitecrest

so you can ask that question every time someone does something thats not
supported by a crappy three and a half year old browser.

I totally agree it is a crappy browser. But that is irrelevant. What
is relevant is that 80+% use it.
 
F

Fredo Vincentis

the image is fixed to the viewport and hence it's origin is located at
the origin of the viewport, not at the origin of the div. Hence only
the part of the image that extends down into the div will be visible.
IE gets this wrong, Gecko gets this right.

Hi Steve,

thanks, that clears things up. I will have to find a workaround then.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top