CSS, Inheriting Colors
Moderator: General Moderators
-
supermike
- Forum Contributor
- Posts: 193
- Joined: Tue Feb 28, 2006 8:30 pm
- Location: Somewhere in the Desert, USA
CSS, Inheriting Colors
Is there a way that I can have multiple classes in my CSS that inherit colors from another class or one central source? That way, I can just change the color scheme at the top and it replicates down.
Not exactly sure what you mean. Is the normal inheriting not enough?
Or maybe you want some kind of groups of styles?
This way, you'll only have to change one class in the html for a complete styleswitch.
Or maybe you want some kind of groups of styles?
Code: Select all
html:
<body class="bluestyle">
<div id="content">
..
</div>
</body>
or
<body class="redstyle">
<div id="content">
..
</div>
</body>
css:
body.bluestyle {
color:#256;
}
.bluestyle #content {
color:#258;
}
.bluestyle #content #intro {
color:#235;
}
body.redstyle {
color:#500;
}
.redstyle #content {
color:#700;
}
.redstyle #content #intro {
color:#900;
}- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
When it comes to styling a page I usually write two stylesheets. One houses the colors of certain elements (body, h1, p, pre, etc...) and the others handle positioning and layout. Then, I can actually create several color variants of the same page and use them interchangeably depending on what I want to see.
You can call two stylesheets in the same manner that you call one.
You can call two stylesheets in the same manner that you call one.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA