Compatible with ie6, ie7, ie8, ff, and google hak

Source: Internet
Author: User
Tags html header

The latest full compatibility with ie6, ie7, ie8, ff, and google

The latest: http://www.chhua.com/web-note762

 

The chaos in the browser market has caused a lot of trouble for designers. After the design page is compatible, the browser must be compatible with that browser. The compatibility between ie6 and ff is easy to solve. It will be troublesome to add ie7, and the emergence of ie8 will be even more troublesome. In the past, the hack ie7 method was useless. What should I do?

Method 1:

Fortunately, Microsoft provides the following code:

<meta http-equiv="x-ua-compatible" content="ie=7″ />

Put this code in

Background: # ffc;/* Valid for firefox */
* Background: # ccc;/* Valid for ie7 */
_ Background: #000;/* only valid for ie6 */

Let's explain:

  • Firefox can parse the first paragraph. Because the first two symbols "*" and "_" are added, firefox cannot recognize them, so it only recognizes background: # ffc and sees yellow;
  • Ie7 can be recognized in the first two short terms. The last line is used as the standard. Therefore, the last line is background: # ccc, and the gray line is displayed;
  • Ie6 can be recognized in three paragraphs, and "_" can only be recognized in ie6. Therefore, the final resolution is _ background: #000, and black is displayed.

Amen! It is already the simplest and best-understood method. If you come in with google, I can tell you responsibly that this method is OK and I have tested it.

I have also tested the code compatible with 7 in ie8. It is okay for ie8 in my current windos 7 test, I don't know whether to use the official ie8 version or not.

Ps: If you find that there is still a problem writing by me, check your html header to see if the previous content is written in this way.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

This is now a more standard writing method. If you use dreamweaver as a page, this is also the default specification. Remember, if it is not such a standard writing method, compatibility cannot be guaranteed.

Method 2:

Demanding friends are reluctant to add such a code in the header of the page as <meta http-equiv = "x-ua-compatible" content = "ie = 7"/>, because the result is that each page must be added. To be compatible with these browsers, you have to find another method. Earlier in the day, this site released an article "css transparent filter for Perfect compatibility with ie6, ie7, ie8 and firefox", which may be neglected during the test at that time. The compatibility of IE8 is not well solved, many of my friends replied that they couldn't use it. Today, I took some time to read a large amount of data and finally solved the problem.

The following statements are compatible with Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, and Internet Explorer FF. Note that the order below cannot be reversed.

# Box {
Background-color: blue;/* ff, google, all stream Inspector */
Background-color: yellow \ 0;/* IE8 supported */
* Background-color: black;/*/7 properties */
_ Background-color: gray;/* ie6 */

 

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.