什么是最好的文档类型? [英] What's the best doctype?

查看:80
本文介绍了什么是最好的文档类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

曾经是这样,文档具有文档类型获得标准模式,没有文档类型的文档得到了怪癖模式。但似乎现在有一些几乎标准模式,不同的浏览器遵循不同的规则等。



用于HTML的最佳文档类型是什么?有什么理由不使用最简单的<!DOCTYPE html>?大多数文档都不会遵循任何特定的DTD。

继续前进,进入未来, HTML5文档类型是我的建议。

 <!DOCTYPE HTML>  

实际上,HTML验证器更关注到一个页面的doctype比浏览器无论如何。



更新:对于那些质疑上述声明的评论者,这里是我的声明来源: Webkit Blog 。它说:

...请注意,与浏览器不同,验证程序会查看您的doctype而不是MIME类型。



另外,FWIW,上述链接博客中Webkit人员的建议是使用HTML 4.01过渡文档类型,并使用MIME类型的text / html,并且将其验证为HTML,而不是

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.

<!DOCTYPE HTML>

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:

...beware, the validator looks at your doctype instead of the MIME type, unlike browsers.

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屋!

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