Contentshtml
本章内容浏览器
An HTML 4 document is composed of three parts:安全
一个HTML 4文档由以下三个部分组成:网络
White space (spaces, newlines, tabs, and comments) may appear before or after each section. Sections 2 and 3 should be delimited by the HTML element.app
在每部分的先后能够出现以空格,换行符,制表符以及注释组成的空白空间。第2部分和第3部分应该由HTML元素来框定。框架
Here's an example of a simple HTML document:ide
下面是一个简单的HTML文档的例子:工具
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD><TITLE>My first HTML document</TITLE> </HEAD> <BODY> <P>Hello world! </BODY> </HTML>
A valid HTML document declares what version of HTML is used in the document. The document type declaration names the document type definition (DTD) in use for the document (see [ISO8879]).ui
一个有效的文档应该声明声明其使用HTML的哪一个版本。文档类型声明命名了文档使用的文档定义类型(请参见[ISO8879])。this
HTML 4.01 specifies three DTDs, so authors must include one of the following document type declarations in their documents. The DTDs vary in the elements they support.
HTML4.01给出了三个DTD,HTML文档做者必须在他们的文档中包含其中的一个。这些DTD在他们支持的元素上有差别:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
The URI in each document type declaration allows user agents to download the DTD and any entity sets that are needed. The following (relative) URIs refer to DTDs and entity sets for HTML 4:
根据文档类型声明中的URI,用户代理能够下载相应的DTD以及它所须要的任何实体集合。下面的(相对)URI用于指定HTML 4的全部DTD和实体集合:
The binding between public identifiers and files can be specified using a catalog file following the format recommended by the Oasis Open Consortium (see [OASISOPEN]). A sample catalog file for HTML 4.01 is included at the beginning of the section on SGML reference information for HTML. The last two letters of the declaration indicate the language of the DTD. For HTML, this is always English ("EN").
public标识符与DTD文件之间的绑定能够用符合Oasis 开放联盟建议格式的目录文件来进行指定。在SGML引用信息部分的最开始包含了一个HTML 4.01的例子目录文件。声明中最后两个字符表示DTD的书写语言。对于HTML来讲,永远是英语,因此这两个字符应该老是“EN”。
Note. As of the 24 December version of HTML 4.01, the HTML Working Group commits to the following policy:
This means that in a document type declaration, authors may safely use a system identifier that refers to the latest version of an HTML 4 DTD. Authors may also choose to use a system identifier that refers to a specific (dated) version of an HTML 4 DTD when validation to that particular DTD is required. W3C will make every effort to make archival documents indefinitely available at their original address in their original form.
注释。在HTML4.01的12月24日版本定稿时,HTML工做组提交了以下的原则:
<!ENTITY % html.content "HEAD, BODY"> <!ELEMENT HTML O O (%html.content;) -- 文档根元素 --> <!ATTLIST HTML %i18n; -- lang, dir -- >
start tag:optional,end tag:optional
开始标签: 可选, 结束标签: 可选
Attribute definitions
属性定义
Attributes defined elsewhere
在其余地方定义的属性
After document type declaration, the remainder of an HTML document is contained by the HTML element. Thus, a typical HTML document has this structure:
在文档类型声明以后,HTML文档的剩余部分由HTML元素承载,一个典型的HTML文档拥有以下结构:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> ...The head, body, etc. goes here...</HTML>
<!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" --> <!ENTITY % head.content "TITLE & BASE?"> <!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head --> <!ATTLIST HEAD %i18n; -- lang, dir -- profile %URI; #IMPLIED -- named dictionary of meta info -- >
start tag:optional,end tag:optional
开始标签: 可选, 结束标签: 可选
Attribute definations
属性定义
Attributes defined elsewhere
在其余地方定义的属性
The HEAD element contains information about the current document, such as its title, keywords that may be useful to search engines, and other data that is not considered document content. User agents do not generally render elements that appear in the HEAD as content. They may, however, make information in the HEAD available to users through other mechanisms.
HEAD元素承载关于当前文档中诸如:标题,对搜索引擎有用的关键字以及其余与文档内容无关的数据。用户代理一般不显示在HEAD内出现的元素。然而,他们能够采用其余的机制将这些HEAD元素内的信息提供给用户。
<!-- The TITLE element is not considered part of the flow of text. It should be displayed, for example as the page header or window title. Exactly one title is required per document. --> <!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title --><!ATTLIST TITLE %i18n>
Start tag: required, End tag: required
开始标签:必须,结束标签:必须
Attributes defined elsewhere
在其余地方定义的属性
Every HTML document must have a TITLE element in the HEAD section.
每个HTML文档都必须在HEAD部分有一个TITLE元素。
Authors should use the TITLE element to identify the contents of a document. Since users often consult documents out of context, authors should provide context-rich titles. Thus, instead of a title such as "Introduction", which doesn't provide much contextual background, authors should supply a title such as "Introduction to Medieval Bee-Keeping" instead.
HTML文档做者应该使用TITLE元素来标识文档的内容。因为用户常常会在语境意外获取文档,因此做者应该提供富含语境信息的标题。例如,做者不该该提供像“Introduction”这样的基本没有语境背景的标题,而应该提供诸如“Introduction to Medieval Bee-Keeping”之类的标题。
For reasons of accessibility, user agents must always make the content of the TITLE element available to users (including TITLE elements that occur in frames). The mechanism for doing so depends on the user agent (e.g., as a caption, spoken).
基于可访问性的缘由,用户代理在任何状况下都必须将TITLE元素(包括出如今框架Frame内的TITLEY元素)的内容展示给最终用户。展示的机制依赖于用户代理自己的实现,好比做为题目或者转化成语音播放。
Titles may contain character entities (for accented characters, special characters, etc.), but may not contain other markup (including comments). Here is a sample document title:
标题内为了包含本土字符以及特殊字符等信息,可使用字符实体,可是不能在标题内出现其余的标记(包括注释在内)。下面是一个文档标题的例子:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>A study of population dynamics</TITLE> ... other head elements... </HEAD> <BODY>... document body... </BODY> </HTML>
Attribute definitions
Unlike the TITLE element, which provides information about an entire document and may only appear once, the title attribute may annotate any number of elements. Please consult an element's definition to verify that it supports this attribute.
和TITLE元素为整个文档提供信息而且只能出现一次不同,titles属性能够标注任意数量的元素。请参与元素的定义信息以确认它们是否支持该属性。
Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. For example, setting the attribute on a link allows user agents (visual and non-visual) to tell users about the nature of the linked resource:
title 属性的值可能会被用户代理采用多种方式展示。好比,可视化浏览器绝大多数状况下会将title显示成一个工具提示(当点设备在对象上停留时出现的简短信 息)。音频用户代理可能会采用人工语音读出该标题信息。举个例子,在一个link上这是该属性将容许用户代理(包括可视化的及非可视化的)告知用户有关链 接资源的性质:
...some text... Here's a photo of <A href="http://someplace.com/neatstuff.gif" title="Me scuba diving"> me scuba diving last summer </A>
...some more text...
The title attribute has an additional role when used with the LINK element to designate an external style sheet. Please consult the section on links and style sheets for details.
在其修饰的LINK元素指向一个外部样式表时,title属性拥有一个附加的角色。请参与连接与样式表部分以获取详细信息。
Note. To improve the quality of speech synthesis for cases handled poorly by standard techniques, future versions of HTML may include an attribute for encoding phonemic and prosodic information.
注释。在某些标准技术不能很好处理的状况下,为了改善语音合成器的质量,在将来的HTML版本中可能会引入一个用于编码语素及韵律信息的属性。
Note. The W3C Resource Description Framework (see [RDF10]) became a W3C Recommendation in February 1999. RDF allows authors to specify machine-readable metadata about HTML documents and other network-accessible resources.
注释。W3C资源描述框架(RDF10)在1999年2月份成为了W3C的官方建议。RDF 容许做者指定关于HTML文档以及其余网络可访问资源的元数据,该元数据是机器可读的。
HTML lets authors specify meta data -- information about a document rather than document content -- in a variety of ways.
HTML容许做者采用多种方式指定元数据,元数据是关于文档的信息而不是文档内容自己。
For example, to specify the author of a document, one may use the META element as follows:
<META name="Author" content="Dave Raggett">
The META element specifies a property (here "Author") and assigns a value to it (here "Dave Raggett").
例如,为了指定文档的做者,可使用以下形式的META元素:
<META name="Author" content="Dave Raggett"> META元素指定了一个属性(这里是"Author")以及给该属性赋值(这里是“Dave Raggett ”)。
This specification does not define a set of legal meta data properties. The meaning of a property and the set of legal values for that property should be defined in a reference lexicon called a profile. For example, a profile designed to help search engines index documents might define properties such as "author", "copyright", "keywords", etc.
本规范没有定义元数据属性的合法集。属性的含义以及该属性的合法取值应该在成为profile的参考词汇中定义。例如,一个用于帮助搜索引擎索引文档的profile可能定义诸如 "author", "copyright", "keywords"等的属性。
指定元数据
In general, specifying meta data involves two steps:
Note that since a profile is defined for the HEAD element, the same profile applies to all META and LINK elements in the document head.
请注意因为profile在HEAD元素中定义,文档头内的全部META及LINK元素都应该共享一样的profile。
User agents are not required to support meta data mechanisms. For those that choose to support meta data, this specification does not define how meta data should be interpreted.
用户代理不须要必定支持元数据机制。对于那些选择支持元数据的用户代理,本规范没有定义元数据应该如何被解读。