Mixing Style Sheets

liunx

Guest
Hi

Is it possible to reference styles in another style? Confused?

The syntex is wrong, but i would like something like this.

.bluecolour {color: #003366}
.redcolour {color: #FF0000}

.bluetext {font-family: arial; color: bluecolour}
.redtext {font-family: arial; color: redcolour}

I would like the value of "bluecolour" to be inserted in the bluetext style.

This example it is obviously easier to just put the correct colour in the bluetext style, but i will ultimately have many different styles, each needing to use the same colour.No you cannot do that with CSS. You can, however, write your style sheet in some other format and then use some method to generate the style sheets. Perl or XSLT are two ways I'd do this.OK. Thanks Charles.If you only want to do something as simple as a colour change (highly doubtful, but still worth a mention), you could do this:

.bluecolour {color: #003366}
.redcolour {color: #FF0000}

.bluetext {font-family: arial;}
.redtext {font-family: arial;}

<p class="bluecolour">
<span class="bluetext">Hello</span>
</p>

As the bluetext span tag will inherit the text colour of the bluecolour p tag.
 
Back
Top