W3C home > Mailing lists > Public > www-style@w3.org > August 2006

Re: Solving the alpha images and background-color problem

From: Ben Ward <ben@ben-ward.co.uk>
Date: Thu, 10 Aug 2006 13:50:10 +0100
Message-Id: <BEC2E791-D4FD-4731-B55E-5DE8EDABA5A6@ben-ward.co.uk>
To: www-style@w3.org
On 4 Aug 2006, at 02:34, Simon Pieters wrote:
>   'background-color'
>      Value: <color> [ <color> ]?
>      Initial: transparent
>      Applies to: all elements
>      Inherited: no
>      Percentages: N/A
>      Media: visual
>      Computed value: <color> <color>

I like this syntax and agree with all the reasons for it being  
useful. One small thing: Should consideration be given to the  
behaviour of this syntax in current implementations?

A quick test reveals that the following behaves inconsistently in  
Safari:

body {
    background: #0F0;
    background: #F00 #00F url(nothere.png);
  }

When using the background shorthand all is fine and the background is  
green, ignoring the proposed new syntax and would neatly allow some  
degree of fallback.

However, when using background-color:
body {
    background-color: #0F0;
    background-color: #F00 #00F;
}

The background is set to red. Safari seems not treat space separated  
values as erroneous and just applies the first one (green). I  
experimented with using a syntax akin to font-size/line-height, but  
Safari still handles that (green). Now well off the topic of defining  
a useful syntax for a CSS spec, I did find that if you use a double  
forward-slash as the separator between colours (#F00//#00F) then  
Safari does ignore the style. No idea what's going on there. Perhaps  
that's one for Dave Hyatt if he still keeps up to date here.

Anyway, I'm certainly not advocating // as the separator based on  
one browser's quirk, but I did want to raise that point that a syntax  
which is ignored as invalid in current implementations may be  
preferable and make evolutionary adoption of this idea by authors  
easier.

Regards,

Ben


Received on Thursday, 10 August 2006 12:50:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:46 GMT