Advertisement

Google Ad Slot: content-top

CSS !important


The !important rule in CSS is used to give a style declaration the highest priority, overriding other declarations for the same property, regardless of the specificity of the selector. This is often used as a last resort when normal specificity rules do not give the desired results.


Syntax:

property: value !important;


Example
.box {
background-color: lightblue;
}
.box.override {
background-color: lightgreen !important; /* Overrides all other background-color rules */
}
#special {
background-color: lightcoral; /* Normally, this would have higher specificity */
}
Try it yourself

Output