homepage Welcome to WebmasterWorld Guest from 54.147.248.118
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Classes in classes (CSS)
Defining Colors and Controlling Stylesheets
Filipe

10+ Year Member



 
Msg#: 298 posted 3:21 am on Aug 29, 2002 (gmt 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.

 

mdharrold

10+ Year Member



 
Msg#: 298 posted 4:25 am on Aug 29, 2002 (gmt 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

tedster

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



 
Msg#: 298 posted 4:29 am on Aug 29, 2002 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved