-
CSS: merging classes
Hi, I think the question is simple:
Code:
<style>
p.R = {color: red}
p.U = {font-deco: underline}
</style>
...
<p class=R class=U> red & underline text wanted </p>
IE takes only the first class. How to specify, or how to write style, which will be the summary of all particular styles?
-
add it to you stylesheet..
<style>
p.R = {color: red}
p.U = {font-deco: underline}
p.RU = {font-deco: underline; color: red}
</style>
it's the correct way to do it..
-
Yes, that's what I've had. When R and U are the case, it works fine. But this begins to be quite ineffective since the combinations of all used 'letters'.
I used this sample to illustrate the problem, in fact I have about six such 'letters', which together gives 6!=720 possibilites.
I don't find usefull to write all these cases, of course; I'm sorry, but is there any other solution...?
-
-
I guess you have to build the necessery stylesheet when you load the page.
you can do this using javascript, php, asp
needed stylesheet =
<style>
p.needed = {color: red; font-deco: underline}
let a script add the stuff you need.