我想知道为什么我应该使用 XHTML 而不是 HTML。
XHTML 应该是“模块化的”,但我还没有看到任何服务器端语言利用其中的任何一个。
XHTML 也更严格,我看不出有什么好处。 XHTML 提供了什么我非常需要的东西?它如何使我的代码“更好”?
编辑:我在评论中发现的另一个问题:Does XHTML parse faster than HTML?
EDIT2:在阅读了您的所有评论和链接之后,我确实同意另一篇文章应该是正确答案,所以我选择了直接链接到最佳来源的那篇文章。
此外,这表明人们甚至没有阅读就对绿色评论进行了投票。
你应该阅读 Beware of XHTML ,这是一篇内容丰富的文章,警告了 XHTML 相对于 HTML 的一些缺陷。
在阅读 XHTML 之前,我对 XHTML 非常狂热,但它确实提出了几个正确的观点。包括以下位;
XHTML 1.x is not “future-compatible”. XHTML 2, currently in the drafting stages, is not backwards-compatible with XHTML 1.x. XHTML 2 will have lots of major changes to the way documents are written and structured, and even if you already have your site written in XHTML 1.1, a complete site rewrite will usually be necessary in order to convert it to proper XHTML 2. A simple XSL transformation will not be sufficient in most cases, because some semantics won't translate properly.
HTML 4.01 is actually more future-compatible. A valid HTML 4.01 document written to modern support levels will be valid HTML 5, and HTML 5 is where the majority of attention is from browser developers and the W3C.
在处理某些项目时, future 的兼容性可能会很大。这篇文章接着提出了其他几个要点,但我认为这对我来说可能是最突出的。
不要将这篇文章误认为是对 XHTML 的咆哮,作者确实谈论了 XHTML 的优点,但在您深入研究之前了解其缺点是有好处的。