Forum Moderators: not2easy

Message Too Old, No Replies

Can the colors be assigned a name?

change multiple colors easily in CSS - how?

         

mihai2u

2:04 am on Apr 11, 2006 (gmt 0)

10+ Year Member



Hello

Let's suppose I use the same color for more objects in my webpage.

Is there a possibility to assign a keyword "bcolor", let's say, to a color, and use it in my css, just like this: background-color:bcolor;?

choster

2:18 am on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is not. In theory you could generate CSS files on the fly with a language like PHP or ASP, however, with such values defined by a variable.

saucey

12:23 pm on Apr 11, 2006 (gmt 0)

10+ Year Member



What I do when I use common colors throughout is assign a class with the color.


.bgcolor
{
background-color:#whatever;
}

Then when I'm coding, I add an additional class to whatever it is I want to add the color to.


<div class="container bgcolor">
Stuff in the middle
</div>

I can then quickly change color schemes by just changing a few classes.

Maybe that helps a little?

mihai2u

3:05 pm on Apr 11, 2006 (gmt 0)

10+ Year Member



Thanks for the ideea.. it's a lot easier than using php.

Saved me a lot of "replace all" :)

Cheers,
Mihai