July 3, 2008 - 2 comments

CSS variables in WebKit

via Webmonkey:

Variables in cascading stylesheets are now available in the nightly WebKit build.

CSS without variables:
//Sets the background of the page and tables to the hex code for the color grey
body {
   background-color: #eceae1;
}
table {
   background-color: #eceae1;
}

With CSS variables:
//Defines "DefaultBGColor" to light gray
@variables {
   DefaultBGColor: #eceae1;
}
//Sets the background and any table on the page to the default background color
body {
   background-color: var(DefaultBGColor);
}
table {
   background-color: var(DefaultBGColor);
}

Jeffrey Barke is senior developer and information architect at theMechanism, a multimedia firm with offices in New York, London and Durban, South Africa.

Published by: jeffreybarke in The Programming Mechanism
Tags: , ,

Comments

Christy
July 7, 2008 at 5:27 pm

Oh man, that sounds amazing! I’m keeping my fingers crossed for CSS3 =)

Comments are closed.

Christy
July 7, 2008 at 5:27 pm

Oh man, that sounds amazing! I’m keeping my fingers crossed for CSS3 =)

Comments are closed.