[whatwg] Background of <body> covering the whole page – is this described somewhere?

Jukka K. Korpela jkorpela at cs.tut.fi
Tue Jul 23 10:37:36 PDT 2013

Browsers seem to be rather consistent in applying the background 
properties of the body element, if set, to the entire viewport, even if 
e.g. the height of the body is explicitly set to a small value. Example:

<!doctype html>
body { background: green; height: 2em; }
Hello world.

The entire viewport has green background. If I add

html { background: white }

to the style sheet, things change radically (to match expectations).

This also affects background images.

This sounds odd, since the body element is a child of html, so we should 
expect the html element background shine thru if the body element has 
transparent background, not vice versa.

Is this described somewhere in HTML or CSS specifications or drafts? I 
think it should be, since it is what browsers do (tested on Firefox, 
Chrome, IE), and even though it sounds absurd, I’m afraid pages may rely 
on it. A natural place to look at is
but I can’t find any statement about the body element extending to cover 
the viewport as far as backgrounds are considered.

Yucca, http://www.cs.tut.fi/~jkorpela/

More information about the whatwg mailing list