RE: Font definition

Matthew Fletcher wrote:

> What about every other value? Wouldn't it be great to be able
> to declare "variables" at the top of a stylesheet and reference
> them where needed. Color schemes are the example that spring
> to mind.


While style sheet defined keywords would be very nice for assigning a 
name to a color and then using it as part of an author or user defined 
palette, there is a problem.  The logical point to derefererence them 
and get the intended value would be when the specified values become 
computed values.  Suppose an aothor style sheet contains definitions 
for the keywords foo and bar that defines foo to be #fefefe and bar to 
be #010101 and uses foo and bar as background and foreground colors. 
Now add in a user style sheet that defines bar to be #fffefd and baz to 
be #020100. Now the rules that the aothor wrote of the form
  X {background-color:foo; color:bar}
become
  X {background-color:#fefefe, color:#fffefd}
which most people won't be able to distinguish.
While unintended interactions between user and author style sheets can 
be a problem in current CSS, they can be guarded against, by, for 
example, always specifying background-color and color at the same time 
since the set of CSS properties is known and finite.  To avoid such 
problems would require that the scop of style sheet defined keywords be 
limited to just the stylesheet that they are a part of (either directly 
or because of an @import rule}.  However, in order to do that you'd 
have to increase the complexity of the CSS parser so that it can handle 
unknown keywords.  Since for the most part, the tasks that style sheet 
defined keywords can do can be done by using grouping of selectors, I 
don't see it as being a worthwhile addition to CSS.  It increases the 
workload involved in interpreting CSS for what would be at most a 
marginal gain in usability, with no gain in capability.  Use of a pre-
processor by the style sheet creator would do just as much without 
requiring any increase in the difficulties of the handling CSS by user 
agents.

Received on Thursday, 29 May 2003 14:45:45 UTC