Take the 2-minute tour ×

Possible Duplicate:
Create a variable in .CSS file for use within that .CSS file

I heard about that we can declare/define variable in CSS and use them like global variables like this:

@nice-blue: #5B83AD;

#header { color: @nice-blue; }

So anyone knows how to use them?

share|improve this question

marked as duplicate by Adam Paynter, Ninefingers, Shog9 Sep 23 '11 at 18:07


w3.org/People/Bos/CSS-variables –  gavenkoa Nov 2 '12 at 12:00
@gavenkoa nobody forces you to use them –  Christophe Roussy Jul 1 at 8:24
add comment

3 Answers

up vote 20 down vote accepted

For that you need to use Less or Sass witch are CSS Dynamic languages.

here's some comparison between both technologies

share|improve this answer
dead links in this answer. –  nickfox Dec 17 '13 at 10:35
Also you could take a look at the CSS Variable Shim @ cssvariables.com –  Brandon.Staley Jan 21 at 17:35
add comment

There is a language written on top of CSS which make use of variables like you asked, it's called LessCSS

share|improve this answer
add comment

You need to use something like SASS


or Less


share|improve this answer
add comment
