- From: Todd Fahrner <todd@verso.com>
- Date: Wed, 30 Sep 1998 16:16:19 -0400 (EDT)
- To: www-style@w3.org
The root element of an HTML document is the HTML element. Historically, however, the root of the "render tree" has been the BODY element. Implementations differ already in which properties may apply to either the HTML or BODY elements, and it is unlikely that analogous conventions will emerge for XML documents. It is therefore desirable, I think, to clarify (a) the relation between the document root and the root of the render tree, and (b) the stylesheet properties applicable to either. Example: if, for an HTML document, I say in CSS (screen media type) that the BODY element should be 400px wide and have a red background, yet the "viewport" is 600px wide, what should be the background color of the remaining 200px? Should it be the color specified (perhaps in the UA sheet) for the HTML element, or should the background color inherit from child to parent in this special case? No version of MSIE I've tested will take a width specification on BODY at all. They do, however, permit specification of margins on this element. But not borders. Don't know about padding. And the background color specified on BODY shows behind the margin area, contrary to the box model given in CSS1. (According to the spec, the bgcolor of the parent should shine through the margins of the child). MacIE4.01 will accept a background-color property on the HTML element, but any color specified on the child BODY will override, no matter what margins are specified on the child. BODY will not accept a border. If you want to get width, borders, padding, and proper margins (the full box model) on BODY in IE - well, you can't. As a workaround, you can throw in a DIV. <div id="body">. This is transparently redundant, and a concession to the general muddle, so hardly a model for standard practice. In contrast, Netscape 4 will accept width specifications on BODY, but the rest of the box model particulars in this case are equally anomalous/buggy with the various flavors of IE. Opera appears to have yet another set of quirks. None of this appears to be documented anywhere, and the result is that most every CSS stylesheet *begins* with a foggy notion of the first rendered box. Lest there be any doubt about the importance of this first box, recall that the "leftmargin", "topmargin", "marginheight", and "marginwidth" attributes were supported on the BODY element by MS/NS in response to user demand - introduced redundantly with CSS. They are still used in favor of CSS in commercial work because CSS implementations around this first box are still a muddle. This must stop. I propose the following clarifications for visual media types: 1. The root of an HTML document is the HTML element. The root element of an XML document can be anything, but it's always present and unique by definition. 2. The root element cannot accept most box properties. Its width is defined as that of the rendering area (e.g. the window or page width). It cannot take either margin or border properties (as outside the width), but it can take padding. It can take only either the "none" or "block" display types. It can also take color and font properties. It cannot float. 3. For HTML explicitly, the BODY (and HEAD) elements should accept all normal box properties, just like any other blocks. The HTML element itself should take most CSS properties excepting those outlined in (2). Thoughts? -- Todd Fahrner The printed page transcends space and time. mailto:fahrner@pobox.com The printed page, the infinitude of books, http://www.verso.com/agitprop/ must be transcended. THE ELECTRO-LIBRARY. - El Lissitzky, 1923
Received on Wednesday, 30 September 1998 16:38:19 UTC