This is a real, real life scenario, because it actually happened yesterday:
- Z-index in jQuery dialog. Autosuggest list not displayed properlyZ-index in jQuery dialog. Autosuggest list not displayed properly
Alternatives to not using !important in my answer included:
- Hunting down in JavaScript/CSS where a certain elusive property was being applied.
- Adding the property with JavaScript, which is little better than using
!important.
So, a benefit of !important is that it sometimes saves time. If you use it very sparingly like this, it can be a useful tool.
If you're using it just because you don't understand how specificity works, you're doing it wrong.
Another use for !important is when you're writing some kind of external widget type thing, and you want to be sure that your styles will be the ones applied, see: