----- Original Message ----- > On Fri, Apr 4, 2008 at 12:43 PM, Pentasis wrote: >> >> Set background-color of html-element to 'transparent' >> set width of body element to anything smaller than the viewport and >> center >> it (margin:0 auto;) >> Make sure padding of body is 0 >> Apply a background color to the body element (for example red) >> >> Now suddenly the whole background is red, in other words, the >> background-color of the body element seeps into it's margins. But >> margins >> are supposed to be transparent according to the spec (I can't find an >> exception anywhere). > > This is probably correct according to what is in the spec at [1], in > particular: > > "The background of the root element becomes the background of the > canvas and covers the entire canvas... > For HTML documents, however, we recommend that authors specify the > background for the BODY element rather than the HTML element. For HTML > documents whose root HTML element has computed values of 'transparent' > for 'background-color' and 'none' for 'background-image', user agents > must instead use the computed value of those properties from that HTML > element's first BODY element child when painting backgrounds for the > canvas, and must not paint a background for that BODY element." > > In short: if there is no background on HTML (i.e. it is transparent), > then the background specified on BODY is applied to the whole canvas, > not really to the BODY. > > Bruno
Today I came across this statement (don't ask me where, I lost the link): "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." But I am unsure if they mean XHTML in general or strictly served as xml? Bert ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
