Trusted answers to developer questions

What is the !important property in CSS?

Checkout some of our related courses
CSS Theming for Professionals
Intermediate
Sass for CSS: Advanced Frontend Development
Beginner
The Complete Advanced Guide to CSS
Beginner

The !important property in CSS means that all subsequent rules on an element are to be ignored, and the rule denoted by !important is to be applied. This rule overrides all previous styling rules ​-- the !important property increases its priority.

svg viewer

Syntax

The !important property is mentioned immediately before the semicolon:

h1 {
  background-color: red !important;
}

Code

In the example below, the normal color for the h1 tag was blue but, because of the !important property, a different color is applied. Similarly, a different color is applied to the background instead of red:

RELATED TAGS

css
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?