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

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 UTC