哪种模式更IE6如果DOCTYPE HTML是作为HTML5? [英] Which mode is IE6 if doctype is html as HTML5?

查看:160
本文介绍了哪种模式更IE6如果DOCTYPE HTML是作为HTML5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果网页都有DOCTYPE为HTML5。

If web page has doctype as HTML5.

<!doctype html>

哪个渲染模式是它IE6?

Which render mode is it for IE6?

document.compatMode 讲述的 CSS1Compat 。它看起来标准模式,而不是怪癖模式。但是,是真的吗? HTML5术语创造之前,IE6被释放。 IE6如何能识别HTML5的doctype?

The document.compatMode tells CSS1Compat. It looks Standard mode, not quirks mode. But, is it true? IE6 is released before HTML5 term is coined. How can IE6 recognize HTML5 doctype?

推荐答案

HTML5的DOCTYPE是专门选择,因为它是最短的doctype字符串可能引发在所有浏览器的标准模式(从IE6)。这是一个深思熟虑的决定基于什么什么会在已经使用的浏览器。

The HTML5 doctype was specifically chosen because it was the shortest doctype string possible that triggered standards mode in all browsers (starting with IE6). This was a deliberate decision based on what what would work in browsers that were already in use.

在换句话说,如果您指定&LT;!DOCTYPE HTML方式&gt; ,IE6应该进入标准模式,而不是怪癖模式

In other words, if you specify <!doctype html>, IE6 should go into standards mode, not quirks mode.

它的工作原理的原因是IE6(和其他人)实际上是在文档类型相当宽松;他们正在做的假设,如果有一个DOCTYPE在那里,开发商很可能意在标准模式。如果他们不承认它,他们假设,无论是开发商做了一个错字或出现的是一个新的文档类型发明了不在身边的浏览器发布时;无论哪种方式,浏览器会尝试做到最好,并在标准模式下工作。在HTML5研究小组发现, HTML 是最短的doctype字符串可能由此引发这种行为,因此其作为HTML5的doctype使用。

The reason it works is because IE6 (and others) are actually quite lenient on the doctype; they're making the assumption that if there's a doctype there, the developer probably intended to be in standards mode. If they don't recognise it, they're assuming that either the developer made a typo or there's been a new doctype invented that wasn't around when the browser was released; either way, the browser attempts to make the best of it and work in standards mode. The HTML5 team discovered that html was the shortest doctype string possible which triggered this behaviour, hence its use as the HTML5 doctype.

什么是HTML5文档类型的的做的当然是触发旧的浏览器IE6一样真正支持任何新的HTML5功能。这是显而易见的实在。产品如 Modernizr的 HTML5Shiv 可以与帮助,但只到一个点。

What the HTML5 doctype doesn't do of course is trigger old browsers like IE6 to actually support any of the new HTML5 features. This is obvious really. Products like Modernizr and HTML5Shiv can help with that, but only up to a point.

这篇关于哪种模式更IE6如果DOCTYPE HTML是作为HTML5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆