Re: Position of 'position: fixed' elements

[Tue, 19 Mar 2002 11:01:23 +0000] Andrew Clover:
>  <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.

At <http://www.w3.org/TR/REC-CSS2/visuren.html#fixed-positioning>
the standard says:
     Fixed positioning is a subcategory of absolute positioning. The only
     difference is that for a fixed positioned box, the containing block is
     established by the viewport.

Also, <http://www.w3.org/TR/REC-CSS2/visudet.html#containing-block-details>
goes into still more detail about how to determine the "containing block."

So the absolute model is indeed followed; but the "containing block"
(to which the top and left properties are relative) is the viewport. 
Opera and Mozilla are correct.
-- 
Randall Joseph Fellmy aka Randy@Coises.com

Received on Tuesday, 19 March 2002 06:33:08 UTC