CSS TutorialLesson 44Free preview
CSS !important
This lesson is part of CSS · All levels
Summary
The important marker forces one declaration to outperform another without regard to order or specificity. It is useful as a rare exception, but when used excessively makes CSS difficult to maintain because every rule eventually comes with an important requirement. Use the necessary tools and make sure the reason for the writing is clear.
Key points
- The syntax: property: value !important; written at the end of the declaration.
- It's more important than the usual specificity or the order of writing.
- Overuse made style difficult to override by other rules later on.
- When two declarations are equally important, specificity becomes the determinant.
- Simplifying the selector is usually better than adding an important one.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.