什么是最好的文档类型? [英] What's the best doctype?
问题描述
用于HTML的最佳文档类型是什么?有什么理由不使用最简单的<!DOCTYPE html>?大多数文档都不会遵循任何特定的DTD。
继续前进,进入未来, HTML5文档类型是我的建议。 <!DOCTYPE HTML>
实际上,HTML验证器更关注到一个页面的doctype比浏览器无论如何。
更新:对于那些质疑上述声明的评论者,这里是我的声明来源: Webkit Blog 。它说:
...请注意,与浏览器不同,验证程序会查看您的doctype而不是MIME类型。
It used to be so that documents with doctypes got standards mode, documents without doctypes got quirks mode. But it seems that these days there are some almost-standard modes, different browsers follow different rules etc. What's the best doctype to use for HTML? Is there any reason not to use the simplest one <!DOCTYPE html>? Most documents don't follow any particular DTD to the letter anyway. Going forward and into the future, the HTML5 Doctype would be my recommendation. In practice, the HTML validators pay far more attention to a page's doctype than browsers do anyway. UPDATE: For those commenters that question the statement immediately above, here is my source for that statement: Webkit Blog. It says: Also, FWIW, the recommendation of the Webkit people in the above linked blog is to use an HTML 4.01 transitional doctype, served with mime-type text/html and validated as HTML, not XHTML. 这篇关于什么是最好的文档类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
另外,FWIW,上述链接博客中Webkit人员的建议是使用HTML 4.01过渡文档类型,并使用MIME类型的text / html,并且将其验证为HTML,而不是<!DOCTYPE HTML>
...beware, the validator looks at your doctype instead of the MIME type, unlike browsers.