Forum Moderators: not2easy
.MasterColour1 { color:red; }
.MasterColour2 { color:blue: }
.MasterColour3 { color:green: }
.MasterText1 { font-family:verdana; }
.MasterText2 { font-family:arial; }
.style1 { color:MasterColour1;font-family:MasterText1; }
.style2 { color:MasterColour3;font-family:MasterText2; }
.style3 { color:MasterColour2;font-family:MasterText2; }
and so on...
So if I now want to change any of the colours or fonts I only have to edit those particular styles. Also if I want to add any new styles I just need to reference the original master styles.
Any help most appreciated.
Cheers - Danny
You can't do that I'm afraid, at least not at present. However, were you aware that you can Specify more than one class per element? [webmasterworld.com]
That revelation (if it is one) will give you a very similar funcionality. ;)
Nick
CSS is not a programming language, nor a scripting language. It is a set of rules, plain text...
I don't know how your PHP skills are?
Create a stylesheet called basic.php instead.
<?php
$MasterColour1 = "red";
$MasterColour2 = "blue";
$MasterColour3 = "green";$MasterText1 = "verdana";
$MasterText2 = "arial";
?>.style1 {
color: <?php echo $MasterColour1;?>;
font-family: <?php echo $MasterText1;?>;
}
.style2 {
color: <?php echo $MasterColour3;?>;
font-family: <?php echo $MasterText2;?>;
}
.style3 {
color: <?php echo $MasterColour2;?>;
font-family: <?php echo $MasterText2;?>;
}
I just have a couple of quick questions to ask: What specification of CSS does this lie under and what browsers support this behaviour?
Thanks (again) in advance,
Danny
I can't believe there isn't a better way of doing this. Maybe Dr Docs suggestion of having some form of global variables might be a better one instead. Might look into defining a xml configuration file containing all master properties which can be easily changed and replicated for my needs across a large number of brands, skins, regions and locales.
It's a shame there's no simple CSS way of doing what I need.
But thanks to you all for your help anyway :)
Danny