Forum Moderators: not2easy

Message Too Old, No Replies

Specify site-wide colour once

         

terrybarnes

4:33 pm on Feb 3, 2009 (gmt 0)

10+ Year Member



Sorry, I'm sure this is a very easy thing to do but I couldn't figure out what to type into Google to search for it!

I have a number of styles on a few different stylesheets for one site but there are a few colours that appear throughout so what I was wondering is whether it's possible to specify that colour once, somewhere in the stylesheet, and then reference some code in all of the other styles. So basically, if I ever want to change the key colours on the site I'll only need to change it in one piece of code.

I'm hoping that all makes sense?

swa66

4:54 pm on Feb 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The trick to do that is to sum up all the selectors that need the color.

E.g.

h1, h2, h3, h4, h5, h6, b, strong {color: teal;}
You'll need a few more one of borders, background colors etc, but it should be just a few in the end to get your theme colors going.

And format all the rest of it elsewhere. There is no need to have all the attributes of a given selector set in one go.

[edited by: swa66 at 8:31 pm (utc) on Feb. 3, 2009]

terrybarnes

4:57 pm on Feb 3, 2009 (gmt 0)

10+ Year Member



Fantastic - thanks for this - I knew it would be something simple but my brain is a little fried today!