W3C home > Mailing lists > Public > www-style@w3.org > March 2002

Position of 'position: fixed' elements

From: Andrew Clover <and@doxdesk.com>
Date: Tue, 19 Mar 2002 11:01:23 +0000
To: www-style@w3.org
Message-ID: <20020319110123.D10897@doxdesk.com>
Afternoon,

I'm currently putting the finishing touches to a JavaScript module to make
'position: fixed' (and 'background-position: fixed') work on IE/Win. I've
noticed a discrepancy between what I think the spec says and what both
Mozilla 0.9.9 and Opera 6.01 do. example code:

  <div style="position: absolute; top: 100px; left: 100px;">
    <div style="position: fixed; top: 0; left: 0;">
      x
    </div>
  </div>

Moz and Op position the fixed inner div at (0, 0) relative to the viewport.
However, by my reading of CSS2 9.3.1, it should be at (100, 100) pixels
relative to the viewport, its position having been calculated "according to
the 'absolute' model" and only then fixed with respect to the viewport.

Who is right?

If Moz/Op is wrong, what should happen when a fixed-position box is contained
within a box with 'overflow: scroll' (or auto)? My reading of the spec would
be that because, because it positioned by the absolute model, it should
move when the overflow-element is scrolled, but not when the viewport is
scrolled. Is this correct?

cheers,

-- 
Andrew Clover
mailto:and@doxdesk.com
http://and.doxdesk.com/
Received on Tuesday, 19 March 2002 06:02:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:13 GMT