若要为网页指定文档模式,请使用 meta 元素,以在网页中包含 X-UA-Compatible http-equiv 标头。 以下示例指定“模仿 IE7”模式兼容性。
<html>
<head>
<!-- Mimic Internet Explorer 7 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<title>My Web Page</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html> content 属性指定页面的模式;若要模仿 Internet Explorer 7 的行为,请指定“IE=EmulateIE7”。 指定“IE=5”、“IE=7”或“IE=8”可选择相应的兼容性模式。 还可以指定“IE=edge”以告诉 Internet Explorer 8 使用可用的最高级别模式。
X-UA-compatible 标头不区分大小写;不过,它必须显示在网页中除 title 元素和其他 meta 元素以外的所有其他元素之前的标头(HEAD 节(可能为英文网页))中。
<html>
<head>
<!-- Mimic Internet Explorer 7 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<title>My Web Page</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html> content 属性指定页面的模式;若要模仿 Internet Explorer 7 的行为,请指定“IE=EmulateIE7”。 指定“IE=5”、“IE=7”或“IE=8”可选择相应的兼容性模式。 还可以指定“IE=edge”以告诉 Internet Explorer 8 使用可用的最高级别模式。
X-UA-compatible 标头不区分大小写;不过,它必须显示在网页中除 title 元素和其他 meta 元素以外的所有其他元素之前的标头(HEAD 节(可能为英文网页))中。