Old 01-03-2007, 08:52   #1 (permalink)
DrBurkstrom
Registered User
 
Join Date: Jan 2007
Posts: 32
Defining pre-set colours in css

I'm sure I remember reading somewhere of how you could set your own colour definitions in a css file, something like this:

Code:
/* create a custom palette */ MAINTEXT: #aabbcc; MAINBGND: #100808; /* specify colours using custom palette names */ body { color: MAINTEXT; background-color: MAINBGND; }

Is this possible somehow?
  Reply With Quote
Old 01-03-2007, 09:18   #2 (permalink)
dtrenz
blam blam
 
dtrenz's Avatar
 
Join Date: Aug 2006
Location: ann arbor, mi usa
Posts: 527
only if you used a script. CSS does not have variables.

you could write your CSS as a php page:

PHP Code:
<?
header
("Content-type: text/css");

$main_content "#333";
$main_bg "#000";
?>

body {
    color: <?=$main_content?>;
    background-color: <?=$main_bg?>;
}
  Reply With Quote
Old 01-03-2007, 10:08   #3 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
sinman has a script that can do that:

http://www.shauninman.com/archive/20.../css_constants
__________________
George Smith - a vain attempt to get higher on google for my name

  Reply With Quote
Old 01-03-2007, 11:21   #4 (permalink)
DrBurkstrom
Registered User
 
Join Date: Jan 2007
Posts: 32
Nice. Thanks very much for that, will also come in handy for some other bits of the site!
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8