W3C home > Mailing lists > Public > www-style@w3.org > May 2005

Re: [css3-background] suggestion of alternate method for drawing shadows

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Mon, 16 May 2005 10:45:17 -0400
Message-ID: <4288B1FD.2070704@earthlink.net>
To: ben <arcticmac@comcast.net>
CC: www-style@w3.org

ben wrote:
> I would suggest that shadows in CSS3 be drawn as follows:
> 1. Color should be specified according to the CSS3 color properties 
> (i.e. with an alpha value)

    No. Alpha suggests a rendering method for shadows involving drawing 
a shape with a certain alpha value on top of whatever is behind the 
element casting the shadow. This means that a red shadow with 100% 
opacity would be just a red box behind the element.

    The color of a real shadow, however, is the result of ambient light. 
Therefore, a red shadow should be a multiplication of the background 
color and the ambient light color (assuming both are sets of three 
floating point numbers between 0.0 and 1.0).

> 2. This means that things below the shadow would still show through, 
> so I'd recommend that the shadow be drawn immediately behind the box. 
> It would then act like a real shadow, and shadow everything beneath 
> it.

    Well, yeah, elements under the shadowing element should have the 
shadow cast on top of them.

> 3. The shadow's opacity in various places should be affected by the 
> opacity of the current box.  For example, if the background of the 
> current box is transparent, but there is a border on the box, you 
> would see a shadow of the border, but it would not be filled in. 

    Agreed.

> (you would also see it inside the box, since the box is transparent 
> and would therefore see through it).  If the background of the box is 
> semi-transparent (via a color with an alpha, an opacity value, OR 
> MAYBE a transparent PNG?) then that opacity value would be applied to 
> the shadow as well.

    Well, I'd like to agree with you, but what happens when you have a 
lot of elements with alpha values inside of an element with a shadow? It 
could get very hard to code very quickly.
Received on Monday, 16 May 2005 16:04:24 GMT

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