Re: Expected behavior of background-clip property on the html element?

On 12/01/2011 6:20 PM, fantasai wrote:
> On 01/11/2011 11:03 PM, Alan Gresley wrote:
>> On 12/01/2011 5:13 PM, fantasai wrote:
>>> The spec says:
>>>
>>> http://www.w3.org/TR/css3-background/#background-clip
>>>
>>> # background-clip ... determines the <dfn>background painting
>>> area</dfn>. # ... # Note that the root element has a different
>>> background painting area. # See “The backgrounds of special
>>> elements.”
>>>
>>> http://www.w3.org/TR/css3-background/#special-backgrounds
>>>
>>> # The background of the root element becomes the background of
>>> the canvas # and its <em>background painting area</em> extends to
>>> cover the entire # canvas
>>>
>>> Exactly what is not clear?
>>
>> Interesting how this is implemented. I ask you what browser handles
>>  this correct?
>
> Given the above-quoted spec text, the entire canvas, aside from the
> blue dots of the html border and the white background of the body box
> which is just high enough to contain the word "test", should be
> gray.


Have another look.

<http://css-class.com/test/css/backgrounds/background-clip-html-body.htm>

This time I have changed the <body> background-color to lime. I have not 
declared background-color white anywhere (this background-color is the 
default background setting of the UA) but this is seen in Opera 11 and 
Safari 5. Opera 11 clips the background to the <html> content-box. IE9 I 
believe does it correctly, please see screenshot[1]. I would be 
interested in know Gecko handles this test.


> I fail to understand why this is not clear from the spec. Perhaps you
> can walk me through an interpretation of the spec that gets you a
> different answer?
>
> ~fantasai


There may be a spec but we are dealing with rendering engines that 
create a tree which stems from some root.

   | If the root's ‘background-color’ value is ‘transparent’, the canvas's
   | background color is UA dependent. The root element does not paint this
   | background again, i.e., the used value of its background is 
transparent.


The UA dependent background-color is the white (this background-color is 
the default background setting of the UA) that the test show. I can only 
assume that in Opera 11 and Safari 5 that the root element is not 
<html>. This beckons the questions like, is there an initial block 
formatting context.


1. <http://css-class.com/test/temp/ie9-bg-clip-html.png>


-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo

Received on Wednesday, 12 January 2011 08:02:39 UTC