Re: [css3-background] 'background: url(foo) white' and 'background: url(foo), white'

On 1/21/11 10:39 AM, tao.yu@nokia.com wrote:
> I am not clear about the last statement in section 3.10 "The 'background' shorthand property", which says:
>
> Note that 'background: url(foo) white' and 'background: url(foo), white' have the same effect.

That's more or less an accident, actually.

The former shorthand specifies one background layer, with a white color 
and url(foo).  The image is painted above the color within a layer.

The latter shorthand specifies two layers, white color on the bottom 
layer and url(foo) on the top one.  This just happens to give the same 
result as having them both in the same layer.

But note that these two shorthands:

   background: white url(foo);
   background: white, url(foo);

do NOT paint the same.  The latter is just white, while the former 
paints the image on top of the white fill.

> Does that mean comma can be used between any of the individual properties and have the same effect as without it?

No.

-Boris

Received on Friday, 21 January 2011 15:50:36 UTC