+ 23
What is the use of "!important" in css? [SOLVED]
Please explain what is the difference between line 1 and line 2 line 1: display:block!important; line 2: display:block; why and where do we use "!important" ?
15 Answers
+ 6
In simple words !important in any css gives it prior importance.
+ 6
Suraj the most important behaviour of ‘!important’ rule are
1. overriding INLINE styles on elements which are not have ‘!important’ in them.
2. the second use is to override long chains in selectors. so so as solution as code
3. the third is override partucular rules in case of classes that are responsible for behaviour. as example .hide {display: none!important} to be sure that element will be defenitely hidden also in case of overwritten display property etc
+ 5
A helpful question. Thanks a lot.
+ 4
don’t use it, it causes a lot of problems, organize your code instead.
+ 3
Lets say we have a code of Css:
“div.Div1 {
display: none;
display: table !important
“
Then Instead of “display: none”
it will do the Most Important one(!important)
one “display: table !important”.
+ 1
Here is the style rule code:
https://code.sololearn.com/Wpjo8QJIXtVy/?ref=app
You can do different things than this.
+ 1
It makes the style over any other is on the selector.
0
Lexus Collins, is it possible that browser could ignore line 2?
0
Lexus Collins, Thank !! I got this 😊😊😊
0
привет всем
0
yas
0
yas
- 2
I think it means "Not Important"!