- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Tue, 23 Jul 2013 20:37:36 +0300
- To: whatwg <whatwg@lists.whatwg.org>
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> <title></title> <style> body { background: green; height: 2em; } </style> 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 http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#the-page 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/
Received on Tuesday, 23 July 2013 17:38:02 UTC