Re: [css3-background] box-shadow syntax

Eli Morris-Heft wrote:
> I noticed what seems to be a mistake or anomaly in the syntax 
> specification for the box-shadow property. The current syntax (as seen 
> at is laid out as:
> none | [ <length> <length> <length>? || <color> ] [ , <length> <length> 
> <length>? || <color> ]+
>  From what I understand about the notation used for the formats of 
> values and from the description of the property, this is not what the 
> spec would expect. Something like:
> 2px 2px #000
> is forbidden due to the plus sign (+) after the second bracketed group. 
> It seems this should be an asterisk (*) so the second bracketed group 
> can be omitted if necessary.

Yes, the grammar is incorrect. No only should the "+" ("one or more") be 
a "*" ("zero or more"), but also the comma is not optional in the second 
group. This is better:

[grammar 1:]

     none | [ <length> <length> <length>? || <color> ]
     [ , [ <length> <length> <length>? || <color> ] ]*

On the other hand, omitting the three <length>s is not very useful: 
without an offset, no part of the shadow is outside the border and thus 
none of it is visible. Maybe the offset should not be optional, or maybe 
the default offset should not be zero.

The former (required offset) leads to a grammar like this

[grammar 2:]

     none | <shadow> [ , <shadow> ]*


     <shadow> = <length> <length> <length>? <color>? |
                <color> <length> <length> <length>?

(I think the grammar for 'text-shadow' in the Text module is like this; 
and indeed I believe the grammar for 'text-shadow' and 'box-shadow' 
should be the same.)

The latter, a non-zero default offset, could say that an omitted offset 
defaults to '1px 1px', or to a UA-dependent value.

>   (I agree with the comment there, though: 
> what are the use cases of multiple shadows? But I digress.)

I originally put in that question in the hope that multiple shadows 
would not be necessary, but I've since discovered that they *are* quite 
useful. See the examples of a text outline and a 3D effect here: To view the 
effect, you'll need Konqueror or a beta of Opera 9.5. Safari hasn't 
implemented multiple shadows yet.

Although it has also been suggested that those two specific effects 
could be separated out, maybe as values on 'text-decoration'....

   Bert Bos                                ( W 3 C )                               W3C/ERCIM                             2004 Rt des Lucioles / BP 93
   +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Wednesday, 7 May 2008 09:41:53 UTC