CSS hack: differentiate IE6, IE7, IE8, and Firefox

Source: Internet
Author: User

The difference between different browsers and CSS hack is that there are manyArticleIn this section, we will try to make it as comprehensive as possible for future reference.
Note that the hack statements described below only apply to xhtml1.0. If <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">

The effect will be different! In addition, the IE8 mentioned here does not refer to the IE8 compatibility mode, because the IE8 compatibility mode is actually IE7.

Difference between IE6, 7, and FF/IE8:
Background: Blue; * Background: orange;

Reference display effect:
Internet Explorer 6/7: Orange
FF/IE8: Blue
Principle: FF/IE8 does not support *, whereas IE6/7 does.

Difference between IE6 and IE7/IE8/FF:
Background: green; _ Background: blue;

Reference display effect:
IE7/8/FF: Green
IE6: Blue
Principle: IE6 supports underlines "_", and IE7, 8, and Firefox do not support underscores.

Difference FF/IE8 and IE6/7:
Background: orange; + Background: green;-Background: blue;
Or
Background: orange; * Background: Green! Important; * Background: blue;

Reference display effect:
IE6: Blue
IE7: Green
FF/IE8: Orange
Principle: IE6 can recognize-, IE7 can recognize +, IE8 and FF cannot recognize + and-
IE8/FF are not recognized *, and IE7 is preferred! Important and IE6 cannot be recognized! Important.

Hacks about IE8:
. Test {
Color:/* \ **/# 00f \ 9;/* IE8 only */
Color: # 00f \ 9;/* Applicable to All ie versions */
}

CSS hacks of IE8, IE7, IE6, and Firefox can be distinguished simultaneously:
. Test {
Color: #000;/* Firefox */
Color:/* \ **/# 00f \ 9;/* IE8 */
* Color: # f00;/* IE7 */
_ Color: #0f0;/* IE6 */
}

IE6 supports (_) _ color: red;

IE7 supports (+) + color: blue;

IE8 supports (/* \ **/... \ 9)/* \ **/color: Black \ 9;

 

IE6 supported _ IE7 IE8 not supported _

_ Color: red; color: blue;

IE6 IE7 * not supported by IE8 *
* Color: red; color: blue;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.