Home>Article>Web Front-end> css important what is
css important is a syntax defined by CSS1. Its function is to increase the application priority of specified style rules and allow the browser to execute this statement first. Its syntax format is such as "{ sRule !important }", which is generally used Doing hacks.
The operating environment of this article: windows10 system, css3, thinkpad t480 computer.
Recommendation: "css video tutorial"
!important in CSS is generally used for hacking, followed by the !important css statement, so that Browsers prefer to execute this statement.
Because css has inherited styles, adding !importanrt can override the parent style. It cannot be recognized in IE6, but can be used in IE7 and other browsers to handle browser compatibility.
!important
!important is a syntax defined by CSS1, which is used to increase the application priority of specified style rules. The syntax format { sRule!important } is written directly at the end of the definition, such as:
p{color:green !important;}
Note: IE has never supported this syntax, but other browsers do. Therefore, we can use this to define styles for FF and IE browsers respectively.
If a style A is defined, such as font-size, and you do not intend to let the style A overwrite this font-size in the future, you can also use !important. And if the new style is also used! important will still be forcibly overwritten
.A{ font-size:12px !important; } .A{ font-size:14px; //不会生效 } .A{ font-size:14px !important; //生效 }
Note that it must be a style with the same name, that is, a style with both style names called A. It will not work if it is a parent and a child, for example :
I am child
In this case, the child's font-size is 14px and is not affected by the father.
The above is the detailed content of css important what is. For more information, please follow other related articles on the PHP Chinese website!