R-U-Bn
asked on
Overruling shortcuts, how to set specificity to overrule ALL?
I have some shortcuts I use a lot in my html pages. Here are 2 exampleis:
.fL { float: left; }
.fR { float: right; }
The problem is that these only have specificity of 020, but I want them to overrule everything.
For example, I have a nice blockquote like this:
.contentpaneopen blockquote { float:right; }
And, because of the lower specificity, this code:
<blockquote class="fL">
gets floated right.
How can I solve this without a css sheet that would become something like this:
.fL, .contentpaneopen .fL, .otherclass .fL, #otherid .fL, #anotherid .fL, #andanotherid #insideanother .fL { float: left; }
(and so on).
.fL { float: left; }
.fR { float: right; }
The problem is that these only have specificity of 020, but I want them to overrule everything.
For example, I have a nice blockquote like this:
.contentpaneopen blockquote { float:right; }
And, because of the lower specificity, this code:
<blockquote class="fL">
gets floated right.
How can I solve this without a css sheet that would become something like this:
.fL, .contentpaneopen .fL, .otherclass .fL, #otherid .fL, #anotherid .fL, #andanotherid #insideanother .fL { float: left; }
(and so on).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Mr. Splash, your first solution is what I was thinking of as a last fall back solution.
Your second is exactly what I do not want. With this I mean that the code you copied from me was just a bad example. It would become full of id's and classes (actually all the ones that exist in my css).
If you don't mind, I will wait a while for possibly more solutions until I accept your first answer as a sort of confirmation that it is not possible what I want. ( If this is rude or impolite on this site, please tell me how to ask for more opinions).
So, does any has any other opinons?
Your second is exactly what I do not want. With this I mean that the code you copied from me was just a bad example. It would become full of id's and classes (actually all the ones that exist in my css).
If you don't mind, I will wait a while for possibly more solutions until I accept your first answer as a sort of confirmation that it is not possible what I want. ( If this is rude or impolite on this site, please tell me how to ask for more opinions).
So, does any has any other opinons?
ASKER
I guess that wás the only option. Maybe once a css protocol version will allow to SET the specificity, something like: .fL (101) { .. } :-)) (because I think there are situations where it would be usefull and efficient).
<style type="text/css">
.fL, .contentpaneopen .fL, .otherclass .fL, #otherid .fL, #anotherid .fL, #andanotherid #insideanother .fL { float: left; }
</style>