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


Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.