Welcome to WebmasterWorld Guest from 54.227.72.69

Forum Moderators: not2easy

Message Too Old, No Replies

Classes in classes (CSS)

Defining Colors and Controlling Stylesheets

     
3:21 am on Aug 29, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 25, 2002
posts:470
votes: 0


Is there a way to make a variable definition of a value for use in a styles? e.g.,

I have a site that I essentially only want to use 6 colors on. I want to set those colors at the head of my stylesheet, and then use those definitions throughout my stylesheet. Here's a pseudocode version of what I'm talking about:

<style>
color1 = red
color2 = orange
color3 = yellow
color4 = green
color5 = blue

H1 {color: color1;}
H2 {color: color2;}
BODY {color: color2;}
TD {color: color3;}
</style>

Since the same color will be used throughout the stylesheet, I'd much rather be able to change the color values at the top rather than having to change them throughout the document. Makes it easier to maintain uniformity.

4:25 am on Aug 29, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Mar 19, 2001
posts:220
votes: 0


Two ways to do it:

1) include a script that will output the styles into the <style> section of each page
2) redesign the site using PHP and do the same as above

4:29 am on Aug 29, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


That would be a very nice extenion of pure CSS. Maybe someday.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members