Xhtml 简明教程

XHTML - Doctypes

XHTML 标准定义了三个文档类型定义 (DTD)。最常用且最简单的是 XHTML 过渡文档。

The XHTML standard defines three Document Type Definitions (DTDs). The most commonly used and easy one is the XHTML Transitional document.

XHTML 1.0 文档类型定义对应于三个 DTD:

XHTML 1.0 document type definitions correspond to three DTDs −

  1. Strict

  2. Transitional

  3. Frameset

有一些 XHTML 元素和属性,在某个 DTD 中可用而在另一个 DTD 中不可用。因此,在编写 XHTML 文档时,您必须仔细选择您的 XHTML 元素或属性。但是,XHTML 验证器可以帮助您识别有效和无效的元素和属性。

There are few XHTML elements and attributes, which are available in one DTD but not available in another DTD. Therefore, while writing your XHTML document, you must select your XHTML elements or attributes carefully. However, XHTML validator helps you to identify valid and invalid elements and attributes.

请参阅 XHTML Validations 了解更多详细信息。

Please check XHTML Validations for more detail on this.

XHTML 1.0 Strict

如果您计划严格使用层叠样式表 (CSS) 并避免编写大部分 XHTML 特性,那么建议使用此 DTD。符合此 DTD 的文档质量较好。

If you are planning to use Cascading Style Sheet (CSS) strictly and avoiding to write most of the XHTML attributes, then it is recommended to use this DTD. A document conforming to this DTD is of the best quality.

如果您想使用 XHTML 1.0 Strict DTD,那么您需要在 XHTML 文档顶部包含以下行。

If you want to use XHTML 1.0 Strict DTD then you need to include the following line at the top of your XHTML document.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.0 Transitional

如果您计划使用许多 XHTML 特性和一些层叠样式表属性,那么您应该使用此 DTD 并相应编写您的 XHTML 文档。

If you are planning to use many XHTML attributes as well as few Cascading Style Sheet properties, then you should adopt this DTD and you should write your XHTML document accordingly.

如果您想使用 XHTML 1.0 Transitional DTD,那么您需要在 XHTML 文档顶部包含以下行。

If you want to use XHTML 1.0 Transitional DTD, then you need to include the following line at the top of your XHTML document.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML 1.0 Frameset

当您想要使用 HTML 框架将浏览器窗口分割成两个或更多个框架时,您可以使用它。

You can use this when you want to use HTML Frames to partition the browser window into two or more frames.

如果您想使用 XHTML 1.0 Frameset DTD,那么您需要在 XHTML 文档顶部包含以下行。

If you want to use XHTML 1.0 Frameset DTD, then you need to include following line at the top of your XHTML document.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Note − 无论您使用什么 DTD 来编写您的 XHTML 文档;如果它是一个有效的 XHTML 文档,那么您的文档被视为一个好的文档。

Note − No matter what DTD you are using to write your XHTML document; if it is a valid XHTML document, then your document is considered as a good quality document.