When an important
rule is used on a style declaration, this declaration overrides any other declarations. Using !important
, is bad practice and should be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets.
Some rules of thumb
- Always look for a way to use specificity before even considering
!important
- Only use
!important
on page-specific CSS that overrides foreign CSS (from external libraries, like Bootstrap or normalize.css).
- Never use
!important
when you're writing a plugin/mashup.
- Never use
!important
on site-wide CSS.