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

RE: Font definition

From: Ernest Cline <ernestcline@mindspring.com>
Date: Thu, 29 May 2003 14:45:41 -0400
To: <www-style@w3.org>
Message-ID: <3ED61D15.30343.45DB6E1@localhost>

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 GMT

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