What does !important do in CSS?

Adding !important after a value makes that declaration win against all normal declarations, even inline styles. Only another !important with a higher specificity can beat it.

p { color: blue !important; }

Avoid it. It breaks the normal cascade and makes the code hard to fix. It is acceptable for small utility classes (like .hidden) or to override styles of a library you cannot edit. See CSS Specificity.


Learn more about the similar topics:
Tutorials
CSS Selectors
CSS Specificity
CSS Pseudo-classes and Pseudo-elements
Exercises & Assignments
No Content Found.
Interview Questions & Answers
What is the CSS class selector?
What is grouping in CSS and what is it used for?
What are child selectors in CSS?
What is the difference between id and class selector in CSS?
What is specificity in CSS?
What does !important do in CSS?
What are pseudo-classes and pseudo-elements in CSS?