HTML and CSS Reference
In-Depth Information
to completion, then you're abusing it, and you (or those that inherit your
projects) will su " er the consequences.
If you include it even sparingly in your stylesheets, you will soon find that
certain parts of your stylesheet will be harder to maintain. As discussed
above, CSS property importance happens naturally through the cascade and
specificity. When you use !important , you're disrupting the natural flow of
your rules, giving more weight to rules that are undeserving of such weight.
If you never use !important , then that's a sign that you understand CSS
and give proper forethought to your code before writing it.
That being said, the old adage “never say never” would certainly apply here.
So below are some legitimate uses for !important .
TO AID OR TEST ACCESSIBILITY
As mentioned, user stylesheets can include !important declarations,
allowing users with special needs to give weight to specific CSS rules that
will aid their ability to read and access content.
A special needs user can add !important to typographic properties like
font-size to make text larger, or to color-related rules in order to increase
the contrast of web pages.
In the screen grab below, Smashing Magazine's home page is shown with a
user-defined stylesheet overriding the normal text size, which can be done
using Firefox's Developer Toolbar:
Search WWH ::




Custom Search