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

Re: [css3-background] proposed box-shadow syntax

From: Eli Morris-Heft <dai@doublefishstudios.com>
Date: Sat, 10 May 2008 00:25:17 -0500
Message-ID: <482531BD.2040109@doublefishstudios.com>
To: Brad Kemper <brkemper@comcast.net>
CC: "www-style@w3.org list" <www-style@w3.org>

Brad Kemper wrote:
> Actually, if I understand the spec language correctly (which it is very 
> possible that I do not), I think you might be missing some double bars, 
> and a question mark, so that the color and key words are optional and 
> their order unimportant. Would the following be more desirable?
> 
> box/text-shadow: none | [[<shadow-size> || <color>?] || [inner | 
> outer]?] [, [<shadow-def> || <color>] [inner | outer]]*
> 
> where <shadow-size> is: [[<length> <length>]? || <length>?] <length>?

(I assume you missed updating the part that comes after the comma, so you meant:
box/text-shadow: none | [[<shadow-size> || <color>?] || [inner | outer]?] [, 
[[<shadow-size> || <color>?] || [inner | outer]?]]* )

This so-called "choke" is a logical idea. That is, if we're going to specify for 
spread, we may as well specify for choke, because it is spread with a negative 
value.

All of the examples you give are legal under your rephrasing, but so is this:

box-shadow: ;

And, confusingly, this:

box-shadow: ,,,,,,,;

For that matter, the empty string is a legal <shadow-size> as well. (Studying 
regexes has given me an eye for when the empty string matches a pattern.) While 
I understand the desire to collapse this into a shorthand property (see more on 
this below), I think it's jarring to have the disconnect between what the first 
<length> represents when one <length> is given and what it represents when two 
are. (That is, blur radius changes into horizontal offset.) If the final syntax 
allows for a one-length variant (which I'm not sure I'm in favor of), I'd like 
it to be used for both the vertical and the horizontal offset, on analogy to 
padding, margin, border, etc.

Blur radius also shouldn't make the shadow any bigger than it is. Under the 
current draft of the spec (not any of our revisions to it) the following two are 
roughly the same size (but the second one is sharper):

box-shadow: 3px 2px 2px blue;
box-shadow: 4px 1px;

> I also propose that this be considered shorthand, and that we also have 
> the individual properties as follows;
> 
> box-shadow-x
> box-shadow-y
> box-shadow-blur
> box-shadow-color
> box-shadow-spread
> box-shadow-cast (e.g. "inner" or "outer")

My main objection to this is this will become difficult to coordinate when you 
specify multiple shadows. I can't think of a happy way around that. Suggestions?

Eli Morris-Heft
dai@doublefishstudios.com
Received on Saturday, 10 May 2008 05:26:18 GMT

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