How can IE6 IE7 IE8 and Firefox be compatible with attributes such as height and width, margin, and padding! Filed under Internet post by dakyi_admin/
Wednesday
The most difficult issue of browser compatibility in web page production is that we are mainly targeting IE6 IE7 IE8 and Firefox, which is a headache for us, the following describes how to control the height and width and other attributes of IE6 IE7 IE8 and Firefox respectively!
Let's take a look at the following CSS code.
Margin-left: 21px! Important; * margin-left: 19px! Important; margin-left: 8px;
Let's explain one sentence! First, pay attention to the order of codes in each sentence!
Margin-left: 21px! Important; this sentence has one! Important is only recognized by Firefox, IE7, and IE8. That is to say, this code does not work for IE6, but this attribute value will also be available later! In this way, we can control the compatible attributes in Firefox.
Next * margin-left: 19px! Important; there is a * symbol in front of this. This symbol can only be recognized by IE, but Firefox cannot recognize it, and a symbol is added later! Important can control IE7 and IE8, because IE7 and IE8 are added with <Meta
HTTP-equiv = "X-UA-compatible" content = "Ie = 7"/> the code is compatible with the same code, and there is no difference between them, therefore, IE7 and IE8 are best compatible.
Last
Margin-left: 8px; this statement is the most normal and must be put to the end, that is, to control the compatibility of IE6. I think this is a bit like the exclusion method in mathematics. There may be more and better ways for browser compatibility to be discovered. Welcome!
For reprinted articles, please indicate the Nokia blog
Address: http://www.126tea.com/blog/post-101.html