0
Pls what is the use of !Important in css
2 Antworten
+ 5
!important is used to override the styles applied for some specific property.
=≈======================================
For example:-
<div id="demo">some content</div>
#demo{
background-color : red;
}
div{
background-color: blue;
}
=≈======================================
As per the above code, the background color of div will be "red" and not "blue".
This is because, the id has more specificity than tag. So inorder to override all the previous style applied, !important is used.
=≈======================================
#demo{
background-color : red;
}
div{
background-color: blue !important;
}
=≈======================================
Now the background-color will be "blue" because the !important will force to override the previous style.
For more info, check about css specificity to understand better.
+ 1
Thanks