IE 8 文档模式 -
有哪些优点和缺点
<meta http-equiv="x-ua-compatible" content="IE=8">
添加到网站 。我希望 IE 8 在 IE 8 Doc 模式下呈现,以便跨浏览器的样式更具凝聚力。我只是担心添加这个的负面后果。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您提供适当的 DOCTYPE,例如
,IE8 将以 IE8 标准模式呈现。在这种情况下,不需要
来强制它。
添加它的唯一后果是即将发布的 IE9 将以 IE8 兼容模式呈现页面。但是,如果您出于某种原因确实想添加它,并且仍将 IE9 保持在自己的标准模式下,您可以使用条件注释来解决它,
但我真的不认为添加它有什么意义。只需使用
即可确保所有浏览器(甚至包括 IE6)中的标准模式。
IE8 will render in IE8 standards mode if you provide an appropriate DOCTYPE, like
<!DOCTYPE html>
.<meta http-equiv="x-ua-compatible" content="IE=8">
is unneeded to force it in this case.The only consequence of adding it though would be that the soon to be released IE9 will render the page in IE8 compatibility mode. But if you really really wanted to add it for some reason, and still keep IE9 in its own standards mode you can work around it with a conditional comment
I just really don't see a point to adding it though. Just have
<!DOCTYPE html>
that will ensure standards mode in ALL browsers (including even IE6).