[thelist] CSS: implementation, who is right?

Peter-Paul Koch gassinaumasis at hotmail.com
Fri Aug 23 06:12:01 CDT 2002


>There seem to be two differing opinions of how the css1
>background-attachment:fixed is implemented, and I'm not sure
>which one it is.

It's a very complicated subject.

>According to Opera website:
>"Positioning of background images is relative to the element
>box, not the window. This means that in Opera, a image placed
>with body{background-position: center center} will be roughly
>in the middle of a page, not in the middle of the window."
>http://www.opera.com/docs/specs/#css

I have the feeling Opera is evading the issue. It doesn't mention background
images in anything but the BODY tag.

>According to Eric Meyer :
>"According to CSS, any background image that is "fixed"
>using background-attachment: fixed; is fixed with respect
>to the viewport-- not the element with which the image
>is associated."
>http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html

As far as I know Eric Meyer sticks to the specs.

>The CSS1 spec leaves me unclear.
>5.3.5 implies that a background attachment is relative to
>the canvas, and 5.3.6 implies that it's relative to the container.
>http://www.w3.org/TR/REC-CSS1#background-attachment

One is about background-attachment, which is calculated from the
viewport/canvas (= the browser window, but one shall never use simple words
in a W3C spec!), the other about background-position.

Anyway, in my feeling Meyer has interpreted the specs correctly, but the
specs themselves are wrong. There is no reason not to allow you to fix
backgrounds relative to any HTML element instead of just the body, as the
specs say.

I played around with Meyer's example and found that it works equally well
when you fix the background image relative to the body (though the image
itself has to be changed to fit better with the rest of the design).
Contrary to what some people (though not Meyer himself) say, the background
image does not *need* to be fixed in the DIV element to get this effect, a
fixed body background works just as well.

I devoutly hope browser vendors will ignore the specs in this particular
instance since the specs don't make sense. Unfortunately only Explorer on
Windows does that, the other browsers all follow the specs.

See also http://www.xs4all.nl/~ppk/css2tests/index.html?background.html

ppk

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com




More information about the thelist mailing list