W3C home > Mailing lists > Public > www-style@w3.org > April 2012

[css-variables] Examples

From: Jens O. Meiert <jens@meiert.com>
Date: Mon, 30 Apr 2012 09:10:26 -0700
Message-ID: <CAJ0g8QT9Gc02VFXmj1S1ipHoJc3qGdQge7pwwDW_gHrrLTiqXQ@mail.gmail.com>
To: www-style@w3.org
Regarding the latest CSS variables draft [1], I recommend to revisit
the examples, at least examples 3 and 4 [2], in order to build a
stronger case for when and how variables are actually useful. It may
be necessary to work with a lot more code to illustrate the usefulness
of variables.

Example 3 is a good example for the problem as there’s no benefit in
using variables here.

:root { color: blue; }
div { color: green; }
#alert { color: red; }

has the same effect, is shorter and more efficient, and a lot easier
to work with.


[1] http://www.w3.org/TR/2012/WD-css-variables-20120410/
[2] http://www.w3.org/TR/2012/WD-css-variables-20120410/#defining-variables

--
Jens O. Meiert
http://meiert.com/en/
Received on Monday, 30 April 2012 16:11:16 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT