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


[1] http://www.w3.org/TR/CSS21/colors.html#background
-- 
Bruno Fassino http://www.brunildo.org/test
______________________________________________________________________
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/

Reply via email to