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

Re: Proposal/idea: variables in CSS

From: (wrong string) äper <christoph.paeper@tu-clausthal.de>
Date: Fri, 17 Jan 2003 13:56:49 +0100
Message-ID: <040501c2be27$e62fced0$3ef4ae8b@heim4.tuclausthal.de>
To: <www-style@w3.org>

Larry Israel:
> In some future incarnation of CSS (maybe CSS4?), I would like to be able
> to set some variables, the contents of which would be replicated in all
> instances of the variable within that style sheet. For example:

IIRC I started here with the same wish, but a different idea how to
implement ("@var" or "var()").

Often there's no need for it, when the cascade is used properly. I would
need it to simplier change colors and widths, but a good CSS editor should
provide a mechanism for variables itself (is there any such?).

> var sans1=("gill sans","trebuchet ms",verdana,helvetica,arial,sans-serif)
> h1 {font-family: sans1; ...

For fonts the @font-face rule already exists, but is AFAIK implemented

@font-face {
    font-family: sans-serif;
    src: local("gill sans"), local("trebuchet ms"),
         local("verdana"), local("helvetica"), local("arial");
h1 {font-family: sans-serif; ...


> I don't know what the best syntax for this would be. var=...

That won't work, due to CSS grammar restrictions, AFAIK. Some @-rule is

> might be confused with the XHTML2 element with the same name,

var is a pretty old element in HTML.

> But I do know that everyone is repeating many definitions in their style
> sheets, especially font "sets."

Yes, but in many cases it's just bad style.

> Variables in (X)HTML could serve as an
> *easy* way to incorporate repeated bits of text

That's a whole different thing, off topic on this list, and could already be
done using custom DTDs and entities.

Christoph Päper
Received on Friday, 17 January 2003 07:56:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:05 UTC