Formalize the hyphen?

When i made a comment about shadows to Bert Bos he mentioned that
a more general-purpose extension scheme would be a good thing to
have.  Upon thinking about it i came up with some other ideas.

It seems that CSS1 tries to represent a hierarchy of information on
quite a few different levels of detail, where each conceptual level
has a different grouping syntax.  Properties for a particular rule
are grouped using curly braces.  The values for a given property
are grouped between a colon and a semicolon.  Properties which
refer to similar kinds of things are prefixed with the same word
before the hyphen.

Only the last of these is not formally specified, and i wondered
if it would make sense to formalize the use of the hyphen.  The
property names already have a lot of consistency in this respect.
Notice also the way "margin", "border", and "font" give you a way
to specify the corresponding "sub-properties".  Similar shorthand
for other properties could let you collapse levels by just giving
values and defining a way to get the properties from the values.

If "shadow" is going to have possibly four or five parameters of
its own, maybe it should be its own property rather than a special
value of "text-decoration" which happens to take extra parameters.
So there might be "shadow-xoffset", "shadow-yoffset", and
"shadow-color".  But there are really more than two levels of
grouping here, so maybe "text-shadow" would be more appropriate
than "shadow".

There are other spots in CSS where the grouping levels are not
quite made clear -- for instance, to specify a border colour
the "color" keyword is missing (implied?), while the meaning
is really something on the order of "border-left-color: red", etc.
The extra grouping levels are dropped so that it looks like all
properties have two levels, even though they don't really.
Similarly "color" really means "text-color" and "vertical-align"
should probably be "align-vertical" if we think of it this way.

I'm not sure if this is necessarily the right way to go, but
this is how i have sorted out the structure of the information
in a CSS stylesheet in my head, and it seemed that perhaps a
more formal attribute hierarchy would be worth thinking about.

Note that i'm not trying to advocate more typing for everyone;
i am just trying to consider the internal model.  Probably
enough shortcuts in the nature of "font" and "margin" would be
possible to make things as concise or even more than they are
now, with a little more consistency.

Hakon Lie wrote:
> 
> How about:
> 
>   text-decoration: shadow(red, 0.1em, 0.2em);
> 
> The functional notation is already in use for rgb and url values. This
> would place a red shadow offset 0.1 em in the x direction and 0.2 em
> in the y direction. As Benjamin notes, one may want influence over
> more parameters. This could be achieved by adding more (optional)
> parameters:
> 
>   text-decoration: shadow(red, 0.1em, 0.2em, 70%, 30%);
> 
>   /* color, x-offset, y-offset, transparency, bluriness */

Interesting.  I don't think CSS1 as it stands is excessively
complicated, but i am a little apprehensive about adding
another level of detail with its own grouping syntax.  The
above would place property values on two levels instead of
one -- "properties" as we know them, and "sub-properties" of
specific property values.  I don't know how likely it will
be for this to proceed to deeper levels, but using a scheme
based on hyphens would be able to handle more levels than two.

Another thing i noticed is that current use of the parens in
CSS1 "feels" more like an "alternate syntax escape" to me
(switch to URL syntax, switch to RGB spec) rather than an
argument-like entity.  But this isn't a really big deal.

Anyway, if the decision is to go with the function-like
syntax, i would suggest a moment's thought about allowing
keyword-tagged arguments.


Ping

Received on Tuesday, 6 August 1996 10:35:56 UTC