HTML:我们真的需要不同的 DocType 吗?
为什么 w3c 有不同文档类型的约定..?相反,他们可以只推荐一种文档类型(比如松散类型……因为它容易出现更少的愚蠢错误),并将其标准化到所有浏览器(包括 mob 和 PDA 中的浏览器)..
< br>我在任何教程中都还没有得到任何令人满意的答案..我一直在阅读“这些不同的文档类型有何不同”,但我想知道我们真的需要它吗???
why w3c has the conventions of different Doc-types .. ? Instead they could have recommended only one Doc-type (say loose type.. as it would prone to less number of SILLY errors) and would have standardized it to all browsers (including the ones in mob and PDAs) ..
I haven't got any satisfying answer in any tutorial yet .. I have been reading "how these different Doc-types differ in" but I want to know do we really need it ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这就是 HTML5 的目标:
That's what HTML5 is going to:
您可能应该听一下Molly Holzschlag 的 Hansel 分钟。他们与斯科特详细讨论了这个问题。
You should probably listen to the Hanselminutes with Molly Holzschlag. They discuss the question with Scott in detail.
旧的文档类型(HTML 5 之前的版本)是 SGML 中的标准化机制,用于嵌入版本和验证信息。如果您使用功能齐全的 SGML 工作流程,它们将为自动处理文件提供很大的可能性。
在这种情况下,HTML 4/XHTML 1 的不同 DOCTYPES 在当时(10 年前)是一个很好的主意。他们允许作者说:“哦,我有一个旧页面,我必须使用这个和那个标签。”或“是的,我使用最新、最干净的标记。我知道我在做什么。”
为什么要使用“公共标识符”之类的东西?好处的一个例子是:它允许在本地存储(并在以后重新分配)任何 HTML 文件的 DTD,并且让您即使在没有 Internet 访问的情况下也可以验证它。 (请记住:SGML 在 80 年代已标准化。)
The old doctypes (pre-HTML 5) are standardized mechanisms in SGML to embed version and validation information. If you use a full-featured SGML workflow, they offer great possibilities to automatically process the file.
In this context the different DOCTYPES of HTML 4/XHTML 1 were then (10 years ago) quite a nice idea. They allowed the authors to say: "Oh, I've an old page, and I'm bound to use this and that tag." or "Yes, I use the newest and cleanest markup out there. I know what I'm doing."
Why this "public identifier" stuff and so? One example of the benefit: It allows to store locally (and re-assign later) the DTD of any HTML file and let's you validate it even without Internet access. (Remember: SGML was standardized in the 80's.)
当前的标准每种语言有 3 个 Doctype,每个都有自己的位置:
The current standards have three Doctypes per language, each has their own place:
嗯,诸如文档类型之类的标准的演变始终是委员会坐在一起制定标准的过程;实际执行标准;标准的错误和失败变得明显;委员会制定了一个新的、改进的标准,但无法从头开始,因为必须保留向后兼容性。因此,引入了修复和解决方法,以便可以在不破坏旧标准的情况下使用新标准。
很多愚蠢的事情都是这样发展的。
正如其他答案所指出的,HTML 5 承诺在这方面做出一些改进。
Well, the evolution of a standard such as doctypes is always a process of committees sitting together and working out a standard; the real word implementing the standard; errors and failures of the standard becoming visible; and the committee working out a new, improved standard, but not being able to start from scratch because backwards compatibility must be retained. So, fixes and workarounds are introduced so that the new standard can be used without breaking the old one.
A lot of silly things have developed that way.
As the other answers point out, HTML 5, though, promises some improvement on that front.