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

Re: positioning the root element

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Sun, 21 Mar 1999 23:31:35 +0000 (BST)
To: "Braden N. McDaniel" <braden@endoframe.com>, Tupshin Harper <tupshin@tupshin.com>, Tantek Celik <tantek@cs.stanford.edu>
cc: www-style <www-style@w3.org>
Message-ID: <Pine.GSO.4.04.9903212124250.29731-100000@midge.bath.ac.uk>

On Fri, 19 Mar 1999, Braden N. McDaniel wrote:
>> Whether the root element of the document is the window or not is
>> completely determined by the browser. It would make no sense for
>> the UA to let that happen [...]
> Why not?

For the same reason as it makes no sense to allow the DOM to modify
the window used to display a document.

I am *STRONGLY* against anything that allows the document's _window_
to be accessed by CSS in *any* way.

When I suggested striking the restriction from the spec, I *in no way*
meant to suggest that the window should be equivalent to the root
element. If the root element *was* the window, *which it isn't*, then
setting margins on the root element should put margins on the browser
window -- quite different from what the spec says *should* happen,
namely that there should be a gap between the edge of the viewport
(browser chrome) and the start of the content.

For example, there is currently no way of doing:

    HTML { margin: 32px; border: solid lime 16px; padding: 32px;
           background: green; color: white; overflow: scroll;
           position: fixed; left: 0; top: 0; right: 0; bottom: 0; }  
    BODY { margin: 32px; border: solid aqua 16px; padding: 32px;
           background: teal; color: yellow; }

...which should result in a document which should have a margin of
32px (of undefined colour) followed by a 16px lime border which should
contain a scroll bar delimited area containing a 64px band of green, a
16px aqua border, a 32px teal padding, yellow on teal text inside,
with the outer band of undefined colour and the 16px lime border being
always visible and never off screen. (That is, the HTML element should
cover *exactly* the viewport. It should *contain* the teal BODY (which
should be surrounded by 64px of green).)

The only way to do this correctly is to put the styles currently on
HTML on BODY, and the styles on BODY on a DIV around the content. This
is clearly unsatisfactory.

   *  *  *

In reply to some of the previous posts:

On Fri, 19 Mar 1999, Braden N. McDaniel wrote:
>> Since the root element has a containing block of its own, chosen by
>> the UA (probably the viewport or page), why can the root element
>> not be positioned?
> Why must the root element have a containing block of its own?

The spec says it does.

As to why the spec says it does, well: 

 a. Where would the root element be rendered, if it was not in some UA
    defined container? The container of the root element is the window
    (or a part of the window) on which the root element is drawn.

 b. What color would the margins of the root element be, if it did not
    have a container with colors of its own?

On Fri, 19 Mar 1999, Tupshin Harper wrote:
> By definition the UA must determine where on the display device the
> root element is displayed. Whether it is the bounds of the
> appropriate window, how far in from the top left of the printed
> page(margin), or however else, the UA determines it's location.
> Therefore the root element is effectively and inherently contained
> within whatever block that the UA determines. If the root element
> didn't have a containing block, then the UA would have no ability to
> determine where on the screen or on the page(or what portion when
> clipping needs to take place) the root element is displayed.


On Fri, 19 Mar 1999, Braden N. McDaniel wrote:
> Indeed. So ostensibly, the root element could be the window and its
> "containing block" could be the desktop.

No. The root element is the highest level element of the document
tree, which in the case of XHTML would be the html element. This is
then contained in the UA defined root element, which could be the
window or the printed page. If it is a window, it may then be
contained in a desktop.

> In which case positioning the root element means positioning the
> window--something a document style sheet has no business doing.

Absolutely. Positioning the root element should only mean moving it
around the window, NOT moving the window itself.

On Fri, 19 Mar 1999, Tupshin Harper wrote:
> Whether the root element of the document is the window or not is
> completely determined by the browser. It would make no sense for the
> UA to let that happen; the only logical thing for the UA to do is to
> do OS level positioning of the window, and then display the document
> within that window. Then the document' stylesheet can determine
> where the root element of the document is displayed within the
> clipping region of that window. In a modern windowed operating
> system, it is the case that a window contains content that the
> application renders to that window. Why postulate a scenario where
> an application specifically overrides that behavior that we are all
> used to? No current browser does that kind of thing, and the
> suggestion that the root element be positionable doesn't imply that
> it should be the case. It merely implies that providing positioning
> on the root element moves the entire viewable content in relation to
> the enclosing window, or in relation to the entire screen if you are
> operating within a full screen mode provided by the UA.


Hmm. Why don't I just shut up and let Tupshin explain it? :-)

Ian Hickson 
U+2642 U+2651
U+262E U+2603 U+263A
Received on Sunday, 21 March 1999 18:31:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:49 UTC