Re: absolute positioning-scheme: 9.3.1

At 11:35 +0300 7/17/01, Manos Batsis wrote:

>Jonathan made me have a look at
>Specifically, section 9.3.1 says about the "absolute" scheme that "The
>box's position (and possibly size) is specified with the 'left',
>'right', 'top', and 'bottom' properties."
>I really liked the "size" part so I tried to test the following:
>  [...zap...]
>Well it does not work. The div is occupying just the space it's inner
>text needs (in IE). Is this rendering correct?

    Hmmm... maybe.  Remember, the BODY element is only as tall as 
necessary to contain its content-- it is NOT the same as the canvas 
(viewport).  Since you've absolutely positioned the DIV, it's been 
taken out of the document flow, so the height of BODY in this example 
is precisely zero.  Neither does your positioned DIV have a 
containing block at this point, except the root element, whose height 
would also (I think!) be zero.  Given this, it may be sensible to 
make the content area as big as necessary to display the content. 
I'd have to work my way through 10.8 again to be sure, and sadly I 
don't have the time right now.
    If you really want to test this, try forcing your BODY to be a 
particular size, like so, and also make it a containing block:

    body {position: relative; height: 200px; width: 200px; background: cyan;}

The background is so you can easily check to see if the height and 
width are being honored by the testing browser, and the relative 
positioning explicitly makes the BODY a containing block.  Given your 
existing positioning styles, you should end up with a 100px by 100px 
positioned box, which covers msot of the BODY.  Feel free to make the 
BODY bigger or smaller to test out the implementation.
    Anyway, as others have said, 
comp.infosystems.www.authoring.stylesheets is probably a better place 
for this kind of question-- although enough theoretical review has 
popped up in this thread that it may stimulate discussion of how CSS 
positioning really works, and ways in which it might be improved, and 
that would be on-topic for the list.

Eric A. Meyer (
Editor, Style Sheets Ref. Guide
Author, "Cascading Style Sheets: The Definitive Guide" and
  "CSS 2.0 Programmer's Reference"

Received on Tuesday, 17 July 2001 10:33:45 UTC