!important is not important!

Thursday 18th September

Break your addiction to !important and make the web a better world.

Within 400 pages of specification, just over half of a page of CSS2.1 is dedicated to discussing !important rules. Most of that discussion relates to the relationship between author style sheets and user style sheets; you know, that feature that no-one ever uses. So the entire body of formal specification relating to “!important”, as it is used today boils down to 2 sentences:

Also, the third author rule will lose to the second author rule since the second rule is “!important”. This shows that “!important” declarations have a function also within author style sheets.

Hardly significant, is it? So why is it I find myself currently working with a set of style sheets containing some 433 !important declarations? Granted, this is a lot of CSS I’m dealing with — 8870 lines in total — but that’s still a hell of a lot of declarations being marked as !important.

It all boils down to the breaking of inheritance and a subsequent slew of !important rules which attempt to fix the problem, but only serve to heighten it. I’m rapidly reaching the conclusion that !important should hardly ever be used, and if you find yourself reaching for this ‘safety net’, think again. There’s an obscure IE hack which could, theoretically justify its use but, as you know, I detest hacks with something of a passion, so, ideally, I’d like never to come across the !important rule ever again. Please.


Tweet

Comments

Wed 10 Dec 2014 18:42

cialis canada 5mg

cialis canada 5mg said:

I’m not sure where you’re getting your info, but good topic.

I needs to spend some time learning much more or understanding more.

Thanks for excellent information I was looking for this information for my mission.

Fri 12 Dec 2014 08:56

cialis from canada

cialis from canada said:

It’s not my first time to visit this web site, i am browsing

this web site dailly and get nice information from here all

the time.

Tue 16 Dec 2014 11:21

buy cialis online us pharmacy

buy cialis online us pharmacy said:

I am curious to find out what blog platform you have been utilizing?

I’m experiencing some minor security problems with my latest blog and I would like

to find something more risk-free. Do you have any solutions?

Thu 18 Dec 2014 19:34

canadian pharmacy cialis

canadian pharmacy cialis said:

Having read this I believed it was really enlightening.

I appreciate you finding the time and energy to put this content together.

I once again find myself personally spending a significant amount of time both reading and leaving comments.

But so what, it was still worthwhile!

Sun 21 Dec 2014 09:45

cialis 20mg

cialis 20mg said:

Hello, I think your web site could possibly be having browser compatibility problems.

Whenever I take a look at your web site in Safari, it looks fine however, when opening in Internet Explorer, it’s got some overlapping

issues. I just wanted to give you a quick heads up! Aside

from that, fantastic site!

Leave a comment