W3C home > Mailing lists > Public > www-style@w3.org > January 2011

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 21 Jan 2011 10:49:32 -0500
Message-ID: <4D39AB0C.8040205@mit.edu>
To: tao.yu@nokia.com
CC: www-style@w3.org, Art.Barstow@nokia.com
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:36 GMT