Johan Brook

  • About
  • Heroes
  • Archive
  • Projects
  • Log
  • Contact

What's this?

I'm Johan, and I'm interested in interface design and front-end development. I freelance as web designer and developer, and study Software Engineering in Gothenburg, Sweden.
More about me

  • Twitter

    @johanbrook
  • Subscribe with RSS

    johanbrook.com/feed
  • E-mail me

    johan at johanbrook . com
More contact stuff
Linked http://trac.webkit.org/browser/trunk/LayoutTests/fast/css/variables/colors-test.html

CSS variables soon to land in WebKit →

‹ Previous post · Next post ›

May 18, 2012 · Permalink · Read more posts about Design and CSS

CSS variables are powerful and almost vital for me nowadays. They are supported in SCSS, LESS and Stylus (all preprocessors). But now WebKit now seem to be on its way of implementing a pure CSS version:

-webkit-var-foreground: green;
-webkit-var-background: rgb(255, 255, 255);

color: -webkit-var(foreground);
background-color: red;
background-color: -webkit-var(background);

I’ve written about a CSS variable implementation before, and even back then I noted that the proposed syntax is bulky and ugly. In the example above you’ll note verbosity and even a vendor prefix (!).

I certainly hope this will be revised and rethought. The way Sass and other preprocessors do it is the way to go:

$foreground: green;
$background: rgb(255,255,255);

color: $foreground;
background-color: red;
background-color: $background;

Johan Brook 2007-2013 · Godkänd för F-skatt