HTML文档根据文档顶部的doctype声明来决定渲染模式,有标准模式(Standards Mode)与怪异模式(Quirks mode,或叫做混杂模式)两种模式。 IE5及以前默认总是表现为怪异模式,IE6~IE8遇到非正常声明或特定声明时也会进入怪异模式。否则,如果有正确声明doctype并在顶端,则默认进入标准模式,即包括HTML5声明在IE6~IE8,也会进入标准模式,而非一定需要HTML4长长的声明。而许多现代浏览器即使是怪异模式,表现也和标准模式是一致的。IE6+进入怪异模式的条件:1.IE6~IE8没有doctype的页面是在怪异模式下渲染。2.在文档类型定义之前出现非空格和换行字符,浏览器也会激活怪异模式。3.除上述两种情况外,有一些特殊声明时用来特定激活怪异模式的。具体见下表,删减至只考虑中国市场常用浏览器(来自《Activating Browser Modes with Doctype》)
Doctype | HTML5 | IE8,IE9 | IE7 | IE6 |
None | Q | Q | Q | Q |
<!DOCTYPEhtml> | S | S | A | A |
<!DOCTYPEhtmlSYSTEM"about:legacy-compat"> | ? | ? | ? | ? |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML3.2Final//EN"> | Q | Q | Q | Q |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0//EN"> | S | S | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01//EN"> | S | S | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0//EN""http://www.w3.org/TR/html4/strict.dtd"> | S | S | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> | S | S | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN"> | Q | Q | Q | Q |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"> | Q | Q | Q | Q |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> | A | A | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> | A | A | A | A |
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> | Q | A | A | A |
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | S | S | A | A |
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTMLBasic1.0//EN""http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> | S | S | A | A |
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | S | S | A | A |
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | A | A | A | A |
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | S | S | A | Q |
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTMLBasic1.0//EN""http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> | S | S | A |
学习交流
热门图片
猜你喜欢的新闻
新闻热点 2024-04-27 13:35:46
2024-04-27 13:33:47
2024-04-24 22:53:44
2024-04-23 19:32:50
2024-04-23 19:25:50
2024-04-23 19:13:19
疑难解答 |