HTML5 聲明相容IE的寫法<!DOCTYPE html> <!--[if IE]> <meta http-equiv="X-UA-Compatible" content="IE=8" /> <![endif]--> <!--[if IE 7]> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <![endif]--> <!--[if IE 6]> <meta http-equiv="X-UA-Compatible" content="IE=6" /> <![endif]--> 關於X-UA-Compatible
目前絕大多數網站都用
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
來作為IE8的相容方法,雖然微軟將IE向標準邁進了一大步,而事實上IE8還存在一系列渲染的奇怪現象是不爭的事實。
誰讓IE6那麼多呢,或許2014年以後我們可以有更多的時間去關心IE8,而不是IE6或者IE7。
在X-UA-Compatible中可用的方法有:
<meta http-equiv="X-UA-Compatible" content="IE=5" >
<meta http-equiv="X-UA-Compatible" content="IE=7" >
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
其中最後一行是永遠以最新的IE版本模式來顯示網頁的。
另外加上
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
而使用,Emulate模式後則更重視<!DOCTYPE>
所以目前來說還是以
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
為首選。
微軟自己創下的罪孽讓他自己去掃吧。
<!DOCTYPE html> <!--[if IE]> <meta http-equiv="X-UA-Compatible" content="IE=8" /> <![endif]--> <!--[if IE 7]> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <![endif]--> <!--[if IE 6]> <meta http-equiv="X-UA-Compatible" content="IE=6" /> <![endif]--> 關於X-UA-Compatible
目前絕大多數網站都用
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
來作為IE8的相容方法,雖然微軟將IE向標準邁進了一大步,而事實上IE8還存在一系列渲染的奇怪現象是不爭的事實。
誰讓IE6那麼多呢,或許2014年以後我們可以有更多的時間去關心IE8,而不是IE6或者IE7。
在X-UA-Compatible中可用的方法有:
<meta http-equiv="X-UA-Compatible" content="IE=5" >
<meta http-equiv="X-UA-Compatible" content="IE=7" >
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
其中最後一行是永遠以最新的IE版本模式來顯示網頁的。
另外加上
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
而使用,Emulate模式後則更重視<!DOCTYPE>
所以目前來說還是以
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
為首選。
微軟自己創下的罪孽讓他自己去掃吧。