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

Re: shadow through transparent background (was Re: Shadow knockout)

From: Eric A. Meyer <eric@meyerweb.com>
Date: Thu, 27 Jan 2011 10:09:31 -0500
Message-Id: <a0623090ac96738c42aee@[192.168.1.128]>
To: Alan Gresley <alan@css-class.com>
Cc: www-style@w3.org
At 5:06 PM +1100 1/27/11, Alan Gresley wrote:

>On 27/01/2011 3:05 PM, Eric A. Meyer wrote:
>
>>  I don't doubt it. I do have to wonder why an outset shadow is clipped by
>>  the border box, though. Because it is a bit weird to shadow a box, then
>>  decide to make the background transparent and not see the rest of the
>>  shadow. Is that an ease-of-implementation thing?
>
>No, some members of the CSS WG in there wisdom decided that a 
>box-shadow seen through a transparent background was wrong. I argued 
>against it back in 2008 [1]. I suggested it again a few weeks ago 
>[2]. It would work like this (the default would be mask).
>
>  box-shadow: 10px 10px 10px 0 <color> cast;

    Very nice!  It certainly satisfies both drop-shadow use cases 
without adding much complexity to the syntax.  Whether it adds 
complexity to implementations is another issue entirely, of course, 
though I'd assume it's roughly as easy to draw a drop shadow entire 
as it is to draw just the parts that aren't masked.
    One question: is 'cast' only honored when a shadow is outset, or 
is the expected behavior that when 'cast' is used in conjunction with 
'inset', the inset shadow will spread outside the border-box?  If so, 
what would it look like?

>>  Or is it that because
>>  backgrounds are transparent by default, it's thought the shadow
>>  shouldn't be visible behind the content because that could create
>>  legibility problems?
>
>Not if it's done carefully. Also a box-shadow does not have to be 
>dark. If you offset the box-shadow enough, you can see how the full 
>box-shadow is rendered.

    Oh, certainly.  Heck, you can make a page thoroughly unreadable 
with plain old CSS1.  I was just speculating about possible 
motivations for specifying that exact behavior.
    On a side note, I have to admit it amuses me that we're wrangling 
over ways to create a visual effect that's *SO* 1998.

-- 
Eric A. Meyer (eric@meyerweb.com)     http://meyerweb.com/
Received on Thursday, 27 January 2011 15:11:13 GMT

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