Html HTML5 doctype 将 IE9 置于怪癖模式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6529728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML5 doctype putting IE9 into quirks mode?
提问by Abhishek
I'm trying to get IE9 to load my page with IE9 standards...
我正在尝试让 IE9 以 IE9 标准加载我的页面...
I noticed having <!DOCTYPE HTML>
puts the damn thing into quirks mode... Which pretty much breaks everything on page...
我注意到已经<!DOCTYPE HTML>
把这该死的东西放到了怪癖模式......这几乎打破了页面上的所有内容......
How do I get IE to stick to IE9 Standards?
如何让 IE 坚持 IE9 标准?
回答by David Wick
Placing:
放置:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
in the <head>
tag should do it.
在<head>
标签中应该这样做。
回答by zuallauz
Make sure you don't have any HTML comments before the DOCTYPE declaration otherwise it will trigger IE9 to use quirks mode.
确保在 DOCTYPE 声明之前没有任何 HTML 注释,否则会触发 IE9 使用 quirks 模式。
Just having <!DOCTYPE html>
at the very top of the page with nothing preceding it should be enough to make IE9 use standards mode. You shouldn't need the meta tag as well.
只要<!DOCTYPE html>
在页面的最顶部没有任何内容就足以让 IE9 使用标准模式。您也不应该需要元标记。
回答by Ian Boyd
Using the WebBrowser
control to display HTML will use IE8 rendering, regardless of doctype, unless you specify
使用WebBrowser
控件显示 HTML 将使用 IE8 渲染,无论文档类型如何,除非您指定
<meta http-equiv="X-UA-Compatible" content="IE=9" />
or
或者
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
回答by Biswajit Chatterjee
Remove any unsupported comments, check for ie supported comments. And place in your head tag. The doc type declaration should be the very 1st line in your HTML.
删除任何不受支持的评论,检查即支持的评论。并放置在您的头部标签中。文档类型声明应该是 HTML 中的第一行。
回答by avinava basu
I have in the head mentioned in all the pages. However it is just showing correctly for the home page for all other pages the page is still rendered in scattered mode.
我在所有页面中都提到了头部。但是,它只是为所有其他页面的主页正确显示该页面仍以分散模式呈现。