Home  >  Article  >  Web Front-end  >  Use one line of code to solve various IE compatibility issues (IE6-IE10)

Use one line of code to solve various IE compatibility issues (IE6-IE10)

巴扎黑
巴扎黑Original
2017-04-17 11:07:221545browse

This article mainly introduces a line of code to solve various IE compatibility issues (IE6-IE10), which has a good reference value. Let’s take a look at it with the editor.

x-ua-compatible is used to specify the model for IE browser to parse and compile the page

x-ua-compatible. The header tag is not case-sensitive and must be Used in head, it must be used before other meta except title.

1. Use one line of code to specify the browser to use a specific document mode.


<meta http-equiv="x-ua-compatible" content="IE=9" >
<meta http-equiv="x-ua-compatible" content="IE=8" >
<meta http-equiv="x-ua-compatible" content="IE=7" >

2. In some cases, we need to limit the browser’s parsing of the document to a specific version, or limit the browser to Some older versions are showing up. You can use the following method:


<meta http-equiv="x-ua-compatible" content="IE=EmulateIE9" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" >

Using this writing method, the browser will either use the standard mode for parsing, or use the IE5 Quirks mode for parsing.

3. For testing, we can also use the following statement to specify that the browser parses the page according to the highest standard mode.


<meta http-equiv="x-ua-compatible" content="IE=edge" >

4. Specification of multiple modes. We can separate multiple versions with commas. In this case, the browser will choose the highest version it supports from this list to render in standards mode. As in the example below, when browsing in IE8, the standards mode of IE7 will be used for rendering, because it does not support IE9 and IE10.


<meta http-equiv="x-ua-compatible" content="IE=7,9,10" >

The above is the detailed content of Use one line of code to solve various IE compatibility issues (IE6-IE10). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn