CSS differences between XHTML and HTML

In XHTML parsed according to XML rules (that is, using an XML MIME-type), there are some differences in behaviour (my brief description). Among those is a CSS quirk which is mentioned in many articles as a potential source of problems (for example, in Sending XHTML as text/html Considered Harmful, Ian Hickson), but rarely described in full. The one reference I could find on SitePoint is unfortunately wrong.

The question is not hard to describe. To begin, in both HTML and XML, the body element behaves just like a div in terms of positioning, sizing, and so on and can be used as a wrapper to place content anywhere on the canvas (see How to Centre and Layout Pages Without a Wrapper, Camen, for some pretty examples). That is the normal behaviour in all cases.

In HTML, html strongly takes a style, so steals the overflow and background properties from the body element if they are set there and not on html. In XHTML, html is styled only according to styles explicitly set on that element, and no "magic" (as Hixie puts it) properties are used to push style up from the body element.

The only styles which html should inherit upwards are background and overflow (in particular, background-color and background-image, and overflow, overflow-x, overflow-y). Contrary to SitePoint and possibly elsewhere, none of these (including CSS3 overflow-*) is inherited in XML. I confirmed this in Firefox for HTML4 and XHTML 1.0.

So, it is simple and easy to check, but the lack of documentation and unclarity in the interaction between the specs has caused confusion. Hopefully this is thorough enough to refer to.

Note on posting this

I was incited to write this while searching in my free half-hour this afternoon for a precise lead on some of the behavioural differences between XHTML and HTML, with not much luck. I ended up rewriting a chunk of the Wikipedia article to de-emphasise the endless tutorial style which there seems to be on every site regarding syntax, but the Wikipedia articles on XML are not great. So, still short of the reference I wanted, I had to write it myself.