[Prev][Next][Index][Thread]

Re: CSS positioning and window dimensions



"David Perrell" <davidp@earthlink.net> asks about the following:

> With this declaration:
> 
>    BODY { overflow: clip; }

The 'overflow:' property here should be ignored, because it only
applies to positionable elements. Since the default value of the
'position:' property is 'static', 'overflow' does not apply. Not
that it makes a difference in this example.

>    DIV  { top: 0; left: 0; width: 100%; height: 100%;
>           overflow: scroll; }
> 
> and this markup:
> 
>    <BODY>
>    <DIV>
>    <P>Does this division element fill the UA window?
>    </DIV>
> 
> what happens?

I'm afraid the behavior is undefined, because the <BODY> element has
a 'height:' of 'auto'. The draft says, "specifying a percentage
value for 'height' if the parent element's height is set to 'auto'
has undefined behavior."

> If the default initial position and size of BODY could be considered
> congruent with the UA's window, CSS positioning would provide an
> alternative to frames for non-scrolling navigation bars.

Based on my interpretation of the draft, of which I am the editor but
not an implementer, this doesn't work. We've had requests for the
ability to position elements relative to the document window, and
this may be considered in the future. For now, I'm afraid you're
stuck with frames.

You _could_ set the size of the <BODY> element to an arbitrary size,
and nest positioned elements (like <DIV>s) within it, using
percentages. The only thing missing is knowledge of the document
window size, although you may be able to determine this in some
scripting environments.

Regards,
--
Robert Stevahn -- mailto:rstevahn@boi.hp.com
+1 208 396 4787 -- HP Business LaserJet Division
Personal: mailto:rstevahn@pobox.com


References: