首页 > 其他 > 详细

各种IE(IE6-IE10)兼容问题一行代码搞定

时间:2018-05-29 18:27:55      阅读:164      评论:0      收藏:0      [点我收藏+]

x-ua-compatible 用来指定IE浏览器解析编译页面的model

 

x-ua-compatible 头标签大小写不敏感,必须用在 head 中,必须在除 title 外的其他 meta 之前使用。

 

1、使用一行代码来指定浏览器使用特定的文档模式。

 

<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、在一些情况下,我们需要限定浏览器对文档的解析到某一特定版本,或者将浏览器限定到一些旧版本的表现中。可以用如下的方式:

 

<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" >

使用这种写法,浏览器或者使用标准模式进行解析,或者使用 IE5 Quirks 模式进行解析。

 

3、为了测试,我们也可以使用下面的语句指定浏览器按照最高的标准模式解析页面。

 

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

4、多个模式的指定。我们可以用逗号分割多个版本,这种情况下,浏览器会从这个列表中选择一个他所支持的最高版本来使用标准模式进行渲染。如下面的例子,在IE8进行浏览时,将会使用IE7的标准模式进行渲染,因为他本身不支持IE9和IE10。

 

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

 

各种IE(IE6-IE10)兼容问题一行代码搞定

原文:https://www.cnblogs.com/cqlb/p/9106308.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!