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類型。
單一字符能夠用字符引用來表示。例如: "&"。