CSS Tidbit
The Task
- override styles that are designated !important
My Tools
This was something that was driving me crazy. The author of the Wordpress Theme that I'm using for a client's project allows you to change the main colors of the theme using a built Theme Options plugin. This is done by including a php file that allows you to programmatically use the colors selected. The problem with this php file is that many of the styles are designated as !important. This designation means that if this is the last included style it will take over and be applied. Previous styles that are designated as !important will be ignored.
In order to override !important all you need to do is make a style with a selector that is more specific than the selector of the style you want to override. You can do with by adding the element or more specific classes and IDs.
Ex:
Instead of...
.navigation {...}
use...
div.navigation {...}