Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to consider the availability of css! important rules from the point of view of maintainability

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to consider the usability of css! important rules from the point of view of maintainability". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The code is as follows:

If (aIsImportant) {

If (! HasImportantBit (aPropID))

Changed = PR_TRUE

SetImportantBit (aPropID)

} else {

/ /...

The code is as follows:

/ * *

* Transfer the state for | aPropID | (which may be a shorthand)

* from | aFromBlock | to this block. The property being transferred

* is! important if | aIsImportant | is true, and should replace an

* existing! important property regardless of its own importance

* if | aOverrideImportant | is true.

*

*.

, /

As you can see from the above, firefox's judgment on the! important rule is simple: the style that contains the! important directly overrides the normally generated style rule, and then if you parse to the following! important rule, compare the priority with the previous important rule. That is, use! important's CSS rule is set to the highest priority, and then the highest priority to determine which style to apply.

The conclusion is that using! important has no negative impact on performance. However, from the point of view of maintainability, we should use this rule less. However, this rule has bug in IE6 (IE6 IE7 (Q) IE8 (Q) does not fully support! important rule), and you should also pay attention to it when using it.

This is the end of "how to consider the availability of css! important rules from a maintainability perspective". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report