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

Re: Position of 'position: fixed' elements

From: Coises <Randy@coises.com>
Date: Tue, 19 Mar 2002 04:33:05 -0700
To: www-style@w3.org
Message-ID: <p67e9uclgdj9rmtkdruuv2312fma5f2kj1@4ax.com>
[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 GMT

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