Position of 'position: fixed' elements

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 UTC