Setting the Background of the Canvas


Sometimes, you need to specify the background color of the window; for example, if the document is so short that it doesn't fill the entire window.

The window (or viewport, as the CSS2 specification calls it since it could also refer to paper if the document is printed) does not correspond to any element in the document. Hence, its color has to come from somewhere else. The background of the window will be the same as the background of the root element. In HTML, the HTML element is always the root element, but XML-based documents will have other root elements. Because it's common to set backgrounds on the BODY element in HTML, the BODY element serves the role of the root element if the background of the HTML element is transparent.

It is as if the background of the root element is stretched to the edges of the window. Even if there is a margin set on the root element, the background will stretch into the margin as well. Some people have described this rule as the canvas "stealing" the background of the root element.



Cascading Style Sheets(c) Designing for the Web
Cascading Style Sheets: Designing for the Web (3rd Edition)
ISBN: 0321193121
EAN: 2147483647
Year: 2003
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net