Previous Message
Next Message

Basic CSS concept? - variables in CSS

Sent by Bryan GARNETT-LAW on 29 October 2004 08:08


Wouldn't it be easier to just apply multiple styles to the element.
Define classes, as per Dave Silvester's e-mail, then apply as 

<p class="other_class accent_light">Some content here</p>

Bryan 
-----Original Message-----
On Thursday 28 Oct 2004 19:49, Ian Skinner wrote:

> The goal here; is there a way to define common elements, colors in 
> this example, that can then be used throughout the style sheet.  Thus 
> providing one place to change the color(s) when and if that becomes 
> necessary.

Can't do it in quite the way you suggested (unless you perhaps used
something 
like PHP or ASP to generate dynamic stylesheets) but what you want to do
is 
already relatively possible in a easy way, just using regular CSS
classes.

The CSS:

..accent_light {
  color: #00ff00;
}

..accent_dark, a:hover {
  color: #00ffdd;
}

..contrast, a:active {
  color: #ff00ff;
}

div.pull {
  background-color: #ff00ff;
}


The HTML:

<h1 class="accent_dark">This will have whatever properties have been
assigned 
to the class accent_dark</h1>

<p class="accent_dark">But so will this, because the class can be
applied to 
just about anything</p>


So, this doesn't quite work with your way having predefined macros (like
you 
can in C with #define and so on), but if you really wanted to do that,
I'd 
suggest you look at using something server side to generate dynamic 
stylesheets.

Hope that helps!

~Dave

-- 

Dave Silvester
Music Technology Junkie
Web: http://www.mu-sly.co.uk/
Email: sly at mu hyphen sly dot co dot uk
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Possibly related: