HTML and CSS Reference
In-Depth Information
If you've dabbled in uniquely-designed blog posts (many designers take
issue with using “art direction” for this technique, and rightly so), as
showcased on Heart Directed, you'll know that such an undertaking requires
each separately-designed article to have its own stylesheet, or else you
need to use inline styles. You can give an individual page its own styles
using the code presented in this article on the Digging Into WordPress blog.
The use of !important could come in handy in such an instance, allowing
you to easily override the default styles in order to create a unique
experience for a single blog post or page on your site, without having to
worry about natural CSS specificity.
!important declarations are best reserved for special needs and users
who want to make web content more accessible by easily overriding default
user agent or author stylesheets. So you should do your best to give your
CSS proper forethought and avoid using !important wherever possible.
Even in many of the uses described above, the inclusion of !important is
not always necessary.
Nonetheless, !important is valid CSS. You might inherit a project wherein
the previous developers used it, or you might have to patch something up
quickly — so it could come in handy. It's certainly beneficial to understand it
better and be prepared to use it should the need arise.
Do you ever use !important in your stylesheets? When do you do so? Are
there any other circumstances you can think of that would require its use?
Search WWH ::

Custom Search