Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS variables. Can this be done?

Status
Not open for further replies.

Kindon

Programmer
Apr 19, 2001
54
0
0
US
I want to be able to set some global colors in a global style sheet. Then use those global settings in other style sheets using the import command.

Here is how I have it set up. I have two base style sheets (globals.css and template.css) that are used in several different web applications. In each application I created a style sheet that imports the global.css and template.css. I then add any additional changes that are needed beyond the "templates".

Global.css is where all the colors are set up. I want to set the colors once and then use those colors to build new components in the various applications. I keep wanting to set a variable like in JavaScript. Can this be done?

This needs to be set up in a way that if I change one color, it changes that color in all applications and its custom components.
 
Here is an example:

color1 = "#000000";
table2 = { background : color1; }

Can this be done?
 
Not using CSS alone. You could use Javascript to do a search and replace over your stylesheet once the page had loaded. But I'm sure the effort involved would outweigh any benefit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top