HTML5兼容IE的写法首页>最新资讯 / NEWS>行业资讯>
-
来作为IE8的兼容方法,虽然微软将IE向标准迈进了一大步,而事实上IE8还存在一系列渲染的奇怪现象是不争的事实。
1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<!–[if IE]>
<metahttp-equiv=”X-UA-Compatible” content=”IE=8″ />
<![endif]–>
<!–[if IE 7]>
<metahttp-equiv=”X-UA-Compatible” content=”IE=7″ />
<![endif]–>
<!–[if IE 6]>
<metahttp-equiv=”X-UA-Compatible” content=”IE=6″ />
<![endif]–>
关于X-UA-Compatible,目前绝大多数网站都用
1
<metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE7">
或许2014年以后我们可以有更多的时间去关心IE8,而不是IE6或者IE7。
在X-UA-Compatible中可用的方法有:
1
2
3
4
<metahttp-equiv="X-UA-Compatible"content="IE=5">
<metahttp-equiv="X-UA-Compatible"content="IE=7">
<metahttp-equiv="X-UA-Compatible"content="IE=8">
<metahttp-equiv="X-UA-Compatible"content="IE=edge">
其中最后一行是永远以最新的IE版本模式来显示网页的。
另外加上
1
2
<metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE7">
<metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE8">
而使用,Emulate模式后则更重视< !DOCTYPE>
所以目前来说还是以
1
<metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE7">
为首选。

