Re: Solving the alpha images and background-color problem

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  

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  



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