Distinguish between different browsers CSS hack: Distinguishing Ie6,ie7,ie8,firefox

Source: Internet
Author: User

  different browsers, CSS hack, from the internet to see a lot of articles, now summed up, as far as possible, for future reference.
Note that the hack written below are applicable only to XHTML1.0. If the HTML is not preceded by the
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
, the effect will be different! In addition, the IE8 described here does not refer to the IE8 compatibility mode, because the IE8 compatibility mode is actually IE7.


Difference IE6, 7 and FF/IE8:
       background:blue;*background:orange;
References
Display effect:
IE 6/7:orange
Ff/ie8:blue
Principle: FF/IE8 does not support the start of * and IE6/7 is supported.


Difference IE6 and ie7/ie8/ff:
       background:green;_background:blue;
References
Display effect:
Ie7/8/ff:green
Ie6:blue
Principle: IE6 supports underscore "_", IE7, 8, and Firefox do not support underscores.



distinguishes Ff/ie8 and IE6/7:
Background:orange;+background:green;-background:blue;
or
Background:o Range;*background:green!important;*background:blue;
References
Display effect:
Ie6:blue
Ie7:green
Ff/ie8:orange
Principle: IE6 can recognize-,ie7 and FF are not recognized + and +,IE8> IE8/FF do not recognize *,IE7 priority recognition!important,ie6 cannot recognize!important.


About IE8 hacks:
. test{
     color: #00f9;
     color:# 00F9;
}

can distinguish between IE8, IE7, IE6, Firefox css hacks:
. test{
     color: #000;
      color: #00f9;
     *color: #f00;
     _color: #0f0;
}

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.