28 June 2023

When to use !important in CSS

“Don’t use !important” is one of those “rules” you absorb as a beginner coder that turns out to be mostly nonsense—like “Don’t use elements for whitespace”.

Here’s what !important means:

That’s it. !important isn’t “badly designed” or an “anti-pattern”, it’s just another way of indicating precedence.