Contentscss
本章内容
html
This section of the specification describes the basic data types that may appear as an element's content or an attribute's value.git
For introductory information about reading the HTML DTD, please consult the SGML tutorial.express
本部分描述了元素的内容里以及属性值中能够出现的基本数据类型。canvas
关于阅读HTML DTD的详细介绍信息,请参阅"SGML教程"。安全
Each attribute definition includes information about the case-sensitivity of its values. The case information is presented with the following keys:app
If an attribute value is a list, the keys apply to every value in the list, unless otherwise indicated.less
每一个属性的定义都包含了改属性值是否大小写敏感的信息。这些大小写信息采用以下键值表示:ide
The document type definition specifies the syntax of HTML element content and attribute values using SGML tokens (e.g., PCDATA, CDATA, NAME, ID, etc.). See [ISO8879] for their full definitions. The following is a summary of key information:ui
文档类型定义在描述HTML元素内容和属性值时采用了SGML的词汇(好比:PCDATA,CDATA,NAME,ID等)。请参见[ISO8879]来获取他们的完整定义。下面是这些关键字的汇总信息:
User agents may ignore leading and trailing white space in CDATA attribute values (e.g., "
For some HTML 4 attributes with CDATA attribute values, the specification imposes further constraints on the set of legal values for the attribute that may not be expressed by the DTD.
Although the STYLE and SCRIPT elements use CDATA for their data model, for these elements, CDATA must be handled differently by user agents. Markup and entities must be treated as raw text and passed to the application as is. The first occurrence of the character sequence "</" (end-tag open delimiter) is treated as terminating the end of the element's content. In valid documents, this would be the end tag for the element.
用户代理能够忽略CDATA型属性值头部和尾部的全部空格,例如: "
对于一些CDATA型的HTML 4 属性值,本规范提供了进一步的取值限制,由于这些限制没有办法用DTD来描述。
虽然STYLE和SCRIPT 元素的数据模型采用CDATA型, 可是对于这些元素来讲,用户代理必须采用另外的方式来处理CDATA。标记和实体必须被当作原始文原本对待,并将其原封不动地传递到相应的应用。第一个字符序列"</" (结束标签起始符) 被认为是元素内容的结束。在一个有效的文档中,这个字符序列应该是元素的结束标签。
A number of attributes ( %Text; in the DTD) take text that is meant to be "human readable". For introductory information about attributes, please consult the tutorial discussion of attributes.
有一些属性,在DTD中描述为%Text参数实体,这些属性将承载“人可读的”文本信息。关于属性的介绍信息,请参阅属性教程式讨论。
This specification uses the term URI as defined in [URI] (see also [RFC1630]).
Note that URIs include URLs (as defined in [RFC1738] and [RFC1808]).
Relative URIs are resolved to full URIs using a base URI. [RFC1808], section 3, defines the normative algorithm for this process. For more information about base URIs, please consult the section on base URIs in the chapter on links.
URIs are represented in the DTD by the parameter entity %URI;.
URIs in general are case-sensitive. There may be URIs, or parts of URIs, where case doesn't matter (e.g., machine names), but identifying these may not be easy. Users should always consider that URIs are case-sensitive (to be on the safe side).
Please consult the appendix for information about non-ASCII characters in URI attribute values.
本规范采用在[URI] 或者[RFC1630])中定义的属于URI,即URI的语义与上述规范定义一致。
须要注意URI包含URL,URL在[RFC1738] and [RFC1808]中定义。
相对URI在基址URI的帮助下会被解析成完整URI。[RFC1808]以及本规范的第三部分都定义了正式这一过程的处理机制。有关基址URI的更多信息,请参阅本规范连接章节中关于基址URI部分。
在DTD中URI采用参数实体%URI;来表示。
通常来讲,URI是大小写敏感的。对于有些URI或者一个URI的默某些部分来讲,大小写是可有可无的,例如:计算机名,可是标识出这种状况不是一件容易的事情。为了安全起见,用户应该老是把URI认为是大小写敏感的。
关于URI属性内非ASCII字符的信息,请参阅相关附录。
The attribute value type "color" (%Color;) refers to color definitions as specified in [SRGB]. A color value may either be a hexadecimal number (prefixed by a hash mark) or one of the following sixteen color names. The color names are case-insensitive.
![]() |
Black = "#000000" | ![]() |
Green = "#008000" |
![]() |
Silver = "#C0C0C0" | ![]() |
Lime = "#00FF00" |
![]() |
Gray = "#808080" | ![]() |
Olive = "#808000" |
![]() |
White = "#FFFFFF" | ![]() |
Yellow = "#FFFF00" |
![]() |
Maroon = "#800000" | ![]() |
Navy = "#000080" |
![]() |
Red = "#FF0000" | ![]() |
Blue = "#0000FF" |
![]() |
Purple = "#800080" | ![]() |
Teal = "#008080" |
![]() |
Fuchsia = "#FF00FF" | ![]() |
Aqua = "#00FFFF" |
Thus, the color values "#800080" and "Purple" both refer to the color purple.
"color"属性值类型,在DTD中为参数实体%Color;,用于对[SRGB]中定义颜色的引用。一个颜色值或者是一个以#开头的十六进制数字,抑或是下面列表中给出的16个颜色名字。颜色名字是不区分大小写的。
![]() |
Black = "#000000" | ![]() |
Green = "#008000" |
![]() |
Silver = "#C0C0C0" | ![]() |
Lime = "#00FF00" |
![]() |
Gray = "#808080" | ![]() |
Olive = "#808000" |
![]() |
White = "#FFFFFF" | ![]() |
Yellow = "#FFFF00" |
![]() |
Maroon = "#800000" | ![]() |
Navy = "#000080" |
![]() |
Red = "#FF0000" | ![]() |
Blue = "#0000FF" |
![]() |
Purple = "#800080" | ![]() |
Teal = "#008080" |
![]() |
Fuchsia = "#FF00FF" | ![]() |
Aqua = "#00FFFF" |
根据上面列表状况,咱们知道颜色值 "#800080" 和"Purple"都引用到相同的深紫色。
Although colors can add significant amounts of information to documents and make them more readable, please consider the following guidelines when including color in your documents:
HTML specifies three types of length values for attributes:
HTML描述了为属性值提供的以下三种类型的长度值:
Note. A "media type" (defined in [RFC2045] and [RFC2046]) specifies the nature of a linked resource. This specification employs the term "content type" rather than "media type" in accordance with current usage. Furthermore, in this specification, "media type" may refer to the media where a user agent renders a document.
This type is represented in the DTD by %ContentType;.
Content types are case-insensitive.
Examples of content types include "text/html", "p_w_picpath/png", "p_w_picpath/gif", "video/mpeg", "text/css", and "audio/basic". For the current list of registered MIME types, please consult [MIMETYPES].
注释。在[RFC2045] 和 [RFC2046]定 义的媒体类型(Media Type)是指一个链接资源的内在属性。为了符合当前的用法,本规范采用”内容类型(Content Type)“而不是”媒体类型(Media Type)“。进一步来讲,在本规范中”媒体类型(Media Type)“能够用来表示用户代理展示(绘制)文档介质。
该类型在DTD中采用参数实体 %ContentType;表示。
内容类型是大小写不敏感的。The value of attributes whose type is a language code ( %LanguageCode in the DTD) refers to a language code as specified by [RFC1766], section 2. For information on specifying language codes in HTML, please consult the section on language codes. Whitespace is not allowed within the language-code.
Language codes are case-insensitive.
语言代码类型的属性值,在DTD中用参数实体 %LanguageCode 表示。其值指的是在[RFC1766]第二部分中定义的语言代码。有关在HTML中指定语言代码的更多信息,请参阅语言代码部分。在语言代码里空格是不容许出现的。
语言代码是大小写不敏感的。
The "charset" attributes (%Charset in the DTD) refer to a character encoding as described in the section on character encodings. Values must be strings (e.g., "euc-jp") from the IANA registry (see [CHARSETS] for a complete list).
Names of character encodings are case-insensitive.
User agents must follow the steps set out in the section on specifying character encodings in order to determine the character encoding of an external resource.
在DTD中采用参数实体%Charset 定义的"charset"属性,是指在字符编码部分所描述的字符编码机制。其取值必须是IANA中正式注册登记的字符串(例如:"euc-jp")。请参阅[CHARSETS] 以得到字符编码的完整列表。
Certain attributes call for a single character from the document character set. These attributes take the %Character type in the DTD.
Single characters may be specified with character references (e.g., "&").
有一些属性只须要一个单独的文档字符集字符。这些属性拥有在DTD中的参数实体%Character类型。
单一字符能够用字符引用来表示。例如: "&"。