CSS compatibility has always been a headache for everyone. Now let's talk about how to differentiate these browsers. IE6, IE7, IE8, and FF all refer to the official IE8 version. Version: 8.0.6001.18702.
Taking color as an example, how to distinguish these browsers:
. Csshack {
Color: # f00;/* display the CSS-supported browsers in red */
Color: # 00f \ 9;/* IE8 can be identified to overwrite the preceding rule in blue */
* Color: #0f0! Important;/* IE7 can identify and overwrite the above rules to be displayed as green */
* Color: #000;/* _ color: #000; * // * IE6 can be identified and overwrite the above rules to be black */
}
Here, "\ 9" can distinguish all IE and Firefox.
"*" IE6 and IE7 can be identified. IE8 and Firefox cannot.
"_" IE6 can recognize "_". IE7, IE8, and Firefox cannot.
Both IE7 and IE8 can be recognized! Important.
In this way, you can completely separate IE6, IE7, IE8, and Firefox.
But pay attention to the order of writing: the browser should write at the beginning, the IE6 should write at the end for overwrite, and other browsers should write in the middle.
Difference between IE6 and FF: Background: orange; * Background: blue;
Difference between IE6 and IE7: Background: Green! Important; Background: blue;
Difference between IE7 and FF: Background: orange; * Background: green;
Difference FF/IE7/IE6: Background: orange; * Background: Green! Important; * Background: blue;
Note: IE can recognize * standard browsers (such as ff) cannot recognize *
IE6 can recognize *, but cannot recognize it! Important
IE7 can recognize * and can also recognize! Important
FF cannot recognize *, but can recognize it! Important
IE6 supports underlines, while IE7 and Firefox do not.
So you can also distinguish IE6, IE7, and Firefox.
: Background: orange; * Background: green; _ Background: blue;
* Html p {color: # f00;} supports IE6 and does not support FF IE7 ie8b.
* + Html p {color: # f00;} supports IE7 ie8b and does not support FF IE6
P {* color: # f00;} supports IE7 IE6 and does not support FF IE8
Note: No matter what method, the order of writing is Firefox's preface, IE7's writing in the middle, and IE6's writing in the back
From hair http://www.yihuan.cc/trackback.asp? Tbid = 53 & Action = addtb & tbkey = 4b60f519832124e44d22e421ff4ba3ba720af645