开发者

Which mode is IE6 if doctype is html as HTML5?

If web page has doctype as HTML5.

&l开发者_如何学Pythont;!doctype html>

Which render mode is it for IE6?

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?


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.

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

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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜