为什么这些条件评论告诉我IE8是IE7?

abe*_*nci 3 html internet-explorer conditional-comments

为什么在Internet Explorer 8上使用此HTML页面:

<p>
<!--[if IE]> According to the conditional comment this is Internet Explorer<br /><!    [endif]-->
<!--[if IE 5]> According to the conditional comment this is Internet Explorer 5<br /> <![endif]-->
<!--[if IE 5.0]> According to the conditional comment this is Internet Explorer 5.0<br /> <![endif]-->
<!--[if IE 5.5]> According to the conditional comment this is Internet Explorer 5.5<br /> <![endif]-->
<!--[if IE 6]> According to the conditional comment this is Internet Explorer 6<br /> <![endif]-->
<!--[if IE 7]> According to the conditional comment this is Internet Explorer 7<br /> <![endif]-->
<!--[if gte IE 5]> According to the conditional comment this is Internet Explorer 5 and up<br /><![endif]-->
<!--[if lt IE 6]> According to the conditional comment this is Internet Explorer lower than 6<br /> <![endif]-->
<!--[if lte IE 5.5]> According to the conditional comment this is Internet Explorer lower or equal to 5.5<br /> <![endif]--> 
<!--[if gt IE 6]> According to the conditional comment this is Internet Explorer greater than 6<br /> <![endif]--> 
</p>
Run Code Online (Sandbox Code Playgroud)

我得到这个结果?

According to the conditional comment this is Internet Explorer
According to the conditional comment this is Internet Explorer 7
According to the conditional comment this is Internet Explorer 5 and up
According to the conditional comment this is Internet Explorer greater than 6
Run Code Online (Sandbox Code Playgroud)

我不应该得到IE8吗?

谢谢.

det*_*lor 5

唯一看来不正确的评论

根据条件评论,这是Internet Explorer 7

浏览器是否处于兼容模式,因为它将呈现为IE7

  • 同时检查DOCTYPE或尝试验证页面可能是个好主意.我认为微软也有一个META标签来触发兼容模式. (2认同)