!important: When and Why Not
Learn what !important does, why it's usually a design smell, and when it's actually appropriate.
What !important Does
Adding !important after a declaration value gives it the highest priority in the author origin cascade, overriding all other author rules for that property regardless of specificity.
.element {
color: red !important;
/* wins over any other non-!important author rule */
}The Legitimate Use Cases
There are valid reasons to use !important:
- User accessibility stylesheets — ensuring text remains readable
- Reduced motion override — disabling animations regardless of component styles
- Utility classes — ensuring a utility like
.hiddenalways wins - Third-party CSS override — when you cannot access the source