Skip to content

HTML doctype-HTML doctype

ARCHIVED

!注意“归档”

This chapter has not been updated for the current version of Orchard, and has been ARCHIVED.

The choice of a doctype is such a choice that we have to make for our own default themes.

选择doctype是我们必须为我们自己的默认主题做出的选择。

This page presents the main points and results of our debate about the choice of a doctype.

本页介绍了我们关于选择doctype的争论的要点和结果。

  • Theme authors will ultimately be free to pick any DTD/doctype they want, this only describes the default ones and the ones that we'll build.

  • 主题作者最终可以自由选择他们想要的任何DTD / doctype,这只描述了默认的和我们将构建的那些。 *

  • Cross-browser compatibility is a must.

  • 跨浏览器兼容性是必须的。 *

  • HTML 5 is the future-proof choice.

  • HTML 5是面向未来的选择。 *

  • XHTML is important to many.

  • XHTML对许多人来说很重要。 *

  • IE6 support is hopefully on its way out but is probably still necessary for the front-end.

  • IE6的支持有望出局,但可能仍然需要前端。 *

  • For the back-end (the admin interface), we have decided to drop IE6 support.

  • 对于后端(管理界面),我们决定放弃IE6支持。 *

  • IE has never really supported XHTML at all but merely tolerated it (it just renders it because XHTML is constrained HTML with some extra stuff that is getting ignored).

  • IE从来没有真正支持XHTML,只是容忍它(它只是渲染它,因为XHTML是受限制的HTML,有些额外的东西被忽略了)。 *

  • XHTML specs recommend serving XHTML with the right MIME type and discourage using several features such as custom namespaces unless that is the case. Unfortunately, that fails in IE.

  • XHTML规范建议使用正确的MIME类型提供XHTML,并且不鼓励使用自定义命名空间等多个功能,除非是这种情况。不幸的是,在IE中失败了。 *

  • HTML 5 does have an XHTML 5 flavor, but it has been considerably scaled down and is now little more than a serialization format.

  • HTML 5确实具有XHTML 5风格,但它已经大大缩小,现在只不过是一个序列化格式。 *

  • The XHTML team at W3C is getting dissolved.

  • W3C的XHTML团队正在解散。 *

  • No existing browser supports all of HTML5 yet.

  • 现有浏览器尚未支持所有HTML5。 *

  • The part of HTML5 markup that is not new will just work on past, present and future browsers.

  • HTML5标记的一部分不是新的,只适用于过去,现在和将来的浏览器。 *

  • HTML5 and past, present and future browsers are resilient to XHTML syntax such as self-closing tags. It will validate against HTML5.

  • HTML5以及过去,现在和将来的浏览器都能够适应XHTML语法,例如自动关闭标签。它将针对HTML5进行验证。 *

  • In reality, browsers ignore the doctype, they have only two modes: quirks and standard (except IE8, which also has IE7 mode, off topic here), pretty much determined by the presence of a doctype, not by its value.

  • 实际上,浏览器忽略了doctype,它们只有两种模式:怪癖和标准(IE8除外,它也有IE7模式,这里不在话题),几乎取决于doctype的存在,而不是它的值。 *

  • We are going to operate in standard mode no matter what our choice of doctype is.

  • 无论我们选择哪种doctype,我们都将以标准模式运行。 *

  • We should use the subset of HTML 5 that will work in today's browsers.

  • 我们应该使用可在今天的浏览器中使用的HTML 5子集。 *

  • We should use markup that is XHTML-compatible (self-closing tags, etc.) even if we don't use a true XHTML doctype.

  • 即使我们不使用真正的XHTML doctype,我们也应该使用与XHTML兼容的标记(自闭标签等)。 *

  • We should make sure our markup validates on the W3C validators.

  • 我们应该确保我们的标记在W3C验证器上有效。 *

In summary, we're recommending the use of the HTML 5 doctype, using the subset of HTML 5 that is compatible with today's browsers and using the XHTML-compatible style.

总之,我们建议使用HTML 5 doctype,使用与当今浏览器兼容并使用XHTML兼容样式的HTML 5子集。

References

参考

  1. The future of XHTML explained as a comic book

1. [XHTML的未来作为漫画书解释](http://media1.smashingmagazine.com/wp-content/uploads/images/xhtml2-html5/comic-960px.jpg)