<!DOCTYPE html> and older browsers

时间秒杀一切 提交于 2019-12-17 18:40:44

问题


Does <!DOCTYPE html> trigger standards mode for older browsers as well? Saying "in all modern browsers" isn't very precise.

I am especially interested in IE6.

Thank you.


回答1:


This is how the HTML5 doctype came into existance (in layman's terms):

The guys who make the standards wanted a simpler doctype. They found out that <!DOCTYPE html> (which is as simple as it gets) does trigger standards mode in browsers. They decided to standardize it in HTML5.

True story.




回答2:


Yes, it does trigger (Almost) Standards Mode in older browsers (such as IE6).

See: http://hsivonen.iki.fi/doctype/

Standards mode, cutting edge validation
<!DOCTYPE html>

This is the right thing to do unless you have a specific reason to avoid it.

The only exception browser (according to that table) is NS6 which nobody is using.

Almost Standards Mode is almost identical to Standards Mode, with some tiny, trivial exceptions:

"Almost standards" rendering mode is exactly the same as "standards" mode in all details save one: the layout of images inside table cells is handled as they are in Gecko's "quirks" mode, which is fairly consistent with other browsers, such as Internet Explorer.



来源:https://stackoverflow.com/questions/5384625/doctype-html-and-older-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!