Root Element Properties

For HTML, but not for XHTML, the CSS2.1 specification recommends that we specify the document background for the body element, rather than for the html element. If the computed value of the background property for the html element is transparent (the initial value), any background properties specified for the body element will be applied to the canvas. This isn’t the case for XHTML.

The CSS2.1 specification also says that an overflow property declared for the body or html elements may be applied to the viewport, but only for HTML documents. In reality, though, browsers apply this property to the viewport for XHTML documents too.

User-contributed notes

ID:
#1
Contributed:
by Nicholas Wilson
Date:
Sat, 29 May 2010 14:17:44 GMT
Status:
This note has not yet been confirmed for accuracy and relevance.

Correction: browsers in XHTML mode do *not* apply overflow to the viewport when defined on <body>. Tested and confirmed.

Related Products