Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

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).
0
R-U-Bn
Asked:
R-U-Bn
  • 2
  • 2
1 Solution
 
Mr_SplashCommented:
The only way I can think to do this would be to give your blockquote a class that gives it the float right. i.e.

.contentpaneopen blockquote.className { float:right; }

So in your HTML all your block quotes look like
<blockquote class="className">

Then for the ones you need to float left the HTML would look like this
<blockquote class="className FL">
0
 
Mr_SplashCommented:
Better yet, add this below the link to your stylesheet;

<style type="text/css">
  .fL, .contentpaneopen .fL, .otherclass .fL, #otherid .fL, #anotherid .fL, #andanotherid #insideanother .fL { float: left; }
</style>
0
 
R-U-BnAuthor Commented:
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?
0
 
R-U-BnAuthor Commented:
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).
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now