Welcome to WebmasterWorld Guest from 184.73.112.180

Forum Moderators: not2easy

Classes in classes (CSS)

Defining Colors and Controlling Stylesheets

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

10+ Year Member



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)

10+ Year Member



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)

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



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

Featured Threads

Hot Threads This Week

Hot Threads This Month