Re: [css3-background]

I agree that this should have been different in the first place. It is, 
indeed, very useful, not just for semi-transparent colors, but also for 
colors combined with background-clip !== border-box. However, there are 
serious backwards compatibility issues if we make such a change at this 
point, which is why I backed off last year when I suggested this myself. 
Let me explain.

The way lists are currently parsed in CSS properties, when fewer values 
are specified than the ones in corresponding lists, the list is padded 
with the same value until it has the same number of items. Therefore, 
when we have multiple background images and one background-color (= all 
current uses of multiple backgrounds on the web), the background-color 
would be treated as if the same color was specified for each background 
layer. So, it would obscure all background images but the topmost one 
and effectively breaking ALL these uses on the web.

Lea Verou (http://lea.verou.me | @LeaVerou)


On 28/2/12 09:52, Marat Tanalin | tanalin.com wrote:
> 28.02.2012, 00:35, "Tab Atkins Jr."<jackalmage@gmail.com>:
>> On Mon, Feb 27, 2012 at 11:38 AM, Lev Solntsev<greli@mail.ru>  wrote:
>>
>>>   Hello!
>>>
>>>   Now CSS Backgrounds and Borders Module Level 3 working draft says that you
>>>   can specify color only on final background layer. It could be reasonable
>>>   because one can see nothing under the solid colored background. But there is
>>>   one option that left forgotten: semi-transparent colors, which can be
>>>   defined with hsla or rgba.
>>>
>>>   Imagine, I may want to place a picture on background, then blend it by
>>>   semitransparent black or white, and place some picture on top. I can't do it
>>>   now with current background syntax and I believe that the specification must
>>>   allow this scenario.
>>>
>>>   Of course, I can fake semitransparent color by a special cooked picture but
>>>   is it what CSS is called to avoid, isn't it?
>> As Brian points out, this restriction has been in B&B for years.
> If restriction is unreasonable, it can and should be fixed. It does not matter how long the restriction did exist before.
>
>> That said, you can achieve the effect you want by with the image()
>> function<http://dev.w3.org/csswg/css3-images/#image-notation>  by just
>> putting the color you want inside of it, as illustrated in example 7
>> at the link I gave.
> This looks like a workaround. "rgba(0,0,255,.5)" is anyway better than "image(rgba(0,0,255,.5))" which is better than "some(nested(function(image(rgba(0,0,255,.5)))))" if they all have identical results.
>

Received on Tuesday, 28 February 2012 09:56:37 UTC