In css! Important is a very important attribute and sometimes plays a very important role. The knowledge of 52css.com is not very much. Let's take a look at the followingArticleFor more information.
I wrote some CSS files a few days ago.CodeIt's hard for me again, because the damn IE6's support for CSS is so bad. I haven't noticed it before, because it's basically based on IE, however, the css I wrote for my blog this time should support more than one IE browser, and I hate Windows 7, which comes with the IE 8 browser. I think there is no problem, however, when I opened IE6, there was still a misposition. So I decided to see what IE6 was like.
I wrap all the CSS blocks with borders. The result shows that the distance between the two divs in IE is obviously wider than that in other browsers. For example, if you write a div whose margin attribute is 20px, in IE, it is like 40px, which is why the precision calculation is just right, but it is misplaced in IE.
Then I saw it! The important attribute is actually in the CSS specification. As a result, IE6 scheme is not supported, and many cssers find a solution because it is not supported. In general, if two identical attributes are written in the same CSS block, they are actually executed according to the following code:
1:Home {
2:Margin-Left:20px;
3:Margin-Left:40px;
4:}
5:
The execution is actually based on 40 PX ,! Important is used to set the priority of the executed statement. If you change the preceding statement:
1:Home {
2:Margin-Left: 20px! Important;
3:Margin-Left:40px;
4:}
5:
In Firefox, Google, and IE7 and later versions, the code will be executed at 20 PX, while in IE6, the code will still be executed at 40 PX, because IE6 does not support it! According to the impant ant specification, we can follow this rule to meet the design requirements of IE6. When we find that IE6 is different from other browsers, we should set two items and add one in the above! Important flag, and the following sentence does not need to be added, so IE6 will be executed according to the following. Senior csser said: Today's CSS everywhere! Important. This is a disaster caused by tiankkill IE6. We all say that IE6 is a metabolic product.