W3C home > Mailing lists > Public > www-style@w3.org > July 2003

Re: Width of an absolute positioned element

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Tue, 22 Jul 2003 15:52:10 -0700
To: Boris Zbarsky <bzbarsky@mit.edu>, Chris Moschini <cmoschini@myrealbox.com>
CC: <chris@christophm.de>, <www-style@w3.org>
Message-ID: <BB430DE1.2B212%tantek@cs.stanford.edu>

On 7/22/03 1:57 PM, "Boris Zbarsky" <bzbarsky@MIT.EDU> wrote:

> Chris Moschini wrote:
>> Consider that in any of those browsers, absolutely positioning
>> Element B inside Element A and setting B's width to 100% causes it to
>> be 100% of the width of A.
> No, it causes Element B to be 100% of the width of its containing block.
> This is only Element A if Element A is positioned or is the root
> element (in CSS2; CSS2.1, as it stands, has that part a little rewritten).\

Almost correct.  Many "HTML UAs" have historically treated the <BODY>
element as the root element, since, as far as HTML is concerned, the <BODY>
*is* the root element for display purposes.

And for absolutely positioned elements, if there is no positioned ancestor,
then the "initial containing block" is the containing block.  The initial
containing block is left as UA-defined, although typically resembles the
"viewport" or the "root element" as you have observed.

Per the looseness of the definition of initial containing block, all the
interpretations you report can be interpreted as compliant.  The easiest way
to eliminate this ambiguity as an author is to pick what element you want as
the "initial containing block" and set "position:relative" on it.

And yes, this portion of CSS2.1 is still in flux.

Received on Tuesday, 22 July 2003 18:52:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:08 UTC