W3C home > Mailing lists > Public > www-style@w3.org > February 2000

Re: CSS entities?

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Thu, 3 Feb 2000 20:17:42 +0100 (MET)
To: www-style@w3.org
Message-ID: <14489.52363.20518.30422@lanalana.inria.fr>
Jonny Axelsson writes:
> Something I have missed when designing a tree of style sheets is some kind
> of parameter mechanism, maybe something similar to SGML entities (like
> %length; and %flow; and all those). It would be particularily useful when
> it comes to colour, where there are several interdependent values (as a
> minimum foreground, background and border), but also for type and probably
> aural style sheets. Single values could rely on the cascade.

It is a very old idea[1]. The CSS WG has discussed it several times, but
each time decided against it. It is useful for certain people
(advanced users, programmers), but on the other hand it represents
another difficult concept for people not so accustomed to indirection.

[1] http://www.w3.org/TR/NOTE-css-potential-19970819.html

It will also pose some problems for the cascade: can you import such
macros? can you override them?

For the DOM it also presents a challenge: there would be symbolic
constants in the programming language as well as in the style sheet
being manipulated. Even programmers wil get confused...

In general, we recommend instead that people use grouping or classes
to express commonality between elements. If, e.g., all headers should
be green, instead of your suggestion of

    %mycolor green

    H1 { color %mycolor }
    H2 { color %mycolor }

you write

    H1, H2, H3, H4, H5, H6 { color: green }

which in many cases is almost as good. And if the fact that the
elements have some common features is already expressed by a class in
the source, you can just use that.

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Thursday, 3 February 2000 14:17:46 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:53 UTC