2 HTML 4 简介
The World Wide Web (Web) is a network of information resources. The Web relies on three mechanisms to make these resources readily available to the widest possible audience:网络
The ties between the three mechanisms are apparent throughout this specification.app
2.1 什么是万维网(World Wide Web)?
万维网(World Wide Web或者Web)是一个信息资源的网络。Web网络依赖三个重要的机制来支持各类可能受众对这些信息资源的快速高效访问。这三个机制以下:框架
- 在Web上定位信息资源的统一命名模式(例如:统一资源标识符URIs)。
- 用于在Web上存取这些进行了统一命名的信息资源的协议(例如: HTTP)。
- 能够在资源之间进行方便导航的超文本内容(例如:HTML)。
这三种机制之间的关联关系在本规范内是明显且无处不在的。ide
Every resource available on the Web -- HTML document, p_w_picpath, video clip, program, etc. -- has an address that may be encoded by a Universal Resource Identifier, or "URI".this
URIs typically consist of three pieces:编码
Consider the URI that designates the W3C Technical Reports page:spa
http://www.w3.org/TR
This URI may be read as follows: There is a document available via the HTTP protocol (see [RFC2616]), residing on the machine www.w3.org, accessible via the path "/TR". Other schemes you may see in HTML documents include "mailto" for email and "ftp" for FTP.设计
Here is another example of a URI. This one refers to a user's mailbox:
...this is text... For all comments, please send email to <A href="mailto:joe@someplace.com">Joe Cool</A>.
Note. Most readers may be familiar with the term "URL" and not the term "URI". URLs form a subset of the more general URI naming scheme.
2.1.1 统一资源标识符(URIs)简介
在Web上的每个可用资源-- HTML文档, 图片, 视频剪辑, 程序, 等等。 -- 都拥有一个能够用统一资源标识符(URI)来编码的地址。
典型的URI包含三部份内容:
- 资源访问机制的命名模式。
- 存放资源的计算机的名字。
- 以路径形式给出的资源自己的名字。
注意下面这个URI,该URI揭示了W3C技术报告页面:
http://www.w3.org/TR这个URI采用以下的方式来阅读: 有一个文档它能够经过HTTP协议(参见【RFC2616】来访问到, 该文档存放在www.w3.org标识的计算机上, 该文档在计算机上可经过路径"/TR"访问到。其余在HTML文档中可能出现的资源访问模式还包括:用于电子邮件的"mailto"以及用于文件传输的"ftp"。
这里还有另一个URI的例子。该URI引用到 一个用户的邮箱:
...一些文本... 若有任何意见和建议,请发送email到<A href="mailto:joe@someplace.com">Joe Cool</A>.
Some URIs refer to a location within a resource. This kind of URI ends with "#" followed by an anchor identifier (called the fragment identifier). For instance, here is a URI pointing to an anchor named section_2:
http://somesite.com/html/top.html#section_2
2.1.2 分段(段落)标识符
有的状况下URI须要引用到一个资源内部的地址。这种类型的URI以井号"#" 结尾,在其后面跟着一个锚定标识符(称为段落标识符)。 举个例子:下面是一个指向名称为section_2的锚定点:
http://somesite.com/html/top.html#section_2
A relative URI doesn't contain any naming scheme information. Its path generally refers to a resource on the same machine as the current document. Relative URIs may contain relative path components (e.g., ".." means one level up in the hierarchy defined by the path), and may contain fragment identifiers.
Relative URIs are resolved to full URIs using a base URI. As an example of relative URI resolution, assume we have the base URI "http://www.acme.com/support/intro.html". The relative URI in the following markup for a hypertext link:
<A href="suppliers.html">Suppliers</A>
would expand to the full URI "http://www.acme.com/support/suppliers.html", while the relative URI in the following markup for an p_w_picpath
<IMG src="../icons/logo.gif" alt="logo">
would expand to the full URI "http://www.acme.com/icons/logo.gif".
In HTML, URIs are used to:
Please consult the section on the URI type for more information about URIs.
2.1.3 相对统一资源标识符(URI)
相对URI不包含任何的命名模式信息。 该种类型的URI指到与当前文档存放在同一台计算机上的资源。相对URI能够包含相对路径信息(例如:".."在路径上上移一层),以及段落标识符。
在基址URI的帮助下,相对URIs会最终被解析成一个全路径的完整的URI. 做为一个相对URI解析的例子,能够设想咱们有一个基址URI "http://www.acme.com/support/intro.html"。在下面文档片断中的相对URI被存放在HTML的超文本连接标签:
<A href="suppliers.html">Suppliers</A>
这个相对URI会被解析成一个完整的URI "http://www.acme.com/support/suppliers.html", 下面的相对URI被放在一个图片标签
<IMG src="../icons/logo.gif" alt="logo">
该相对URI将被解析成的完整URI是:"http://www.acme.com/icons/logo.gif"。
在HTML里, URI被用于:
- 连接到另外的文档或资源(参见 A 和 LINK 元素)。
- 连接到外部的样式表或脚本(参见 LINK 和 SCRIPT 元素)。
- 在页面里包含(引入)图片,对象或者Applet(参见 IMG, OBJECT, APPLET 和 INPUT 元素)。
- 建立图像地图(参见MAP 和 AREA 元素)。
- 提交表单(参见 FORM)。
- 建立框架文档(参见 FRAME 和 IFRAME 元素)。
- 引用外部参考资料(参见 Q, BLOCKQUOTE, INS 和 DEL 元素)。
- 引用描述文档的元数据约定(参见 HEAD 元素)。
有关URI更多的信息请咨询URI 类型部分。
To publish information for global distribution, one needs a universally understood language, a kind of publishing mother tongue that all computers may potentially understand. The publishing language used by the World Wide Web is HTML (from HyperText Markup Language).
HTML gives authors the means to:
2.2 HTML是什么?
为了达到发布信息的全球传播的目的,咱们须要一个全世界均可以理解的语言-某种可以被全部的计算机理解的发布母语。在万维网(World Wide Web)领域这种发布(出版)的语言就是HTML。
HTML提供给文档做者以下方法来进行他们的出版(发布)工做:
- 用headings, text, tables, lists, photos, etc来发布在线文档。
- 经过点击一个按钮的方式获取超连接所揭示的在线信息。
- 设计表单来与远程服务进行交易处理,好比搜索信息,订机票,购买商品等等。
- 在他们的文档中直接包含电子表格(spread-sheets),视频剪辑(video clips), 音频剪辑(sound clips),以及其余的应用。
HTML was originally developed by Tim Berners-Lee while at CERN, and popularized by the Mosaic browser developed at NCSA. During the course of the 1990s it has blossomed with the explosive growth of the Web. During this time, HTML has been extended in a number of ways. The Web depends on Web page authors and vendors sharing the same conventions for HTML. This has motivated joint work on specifications for HTML.
HTML 最初由Tim Berners-Lee在CERN期间发明,因为在NCSA开发的Mosaic浏览器而变得流行。在20世纪90年代随着Web的爆炸式增加而飞速发展。 在那时,HTML已经在多个方面以多种途径进行了扩展。Web依赖于网页文档的做者以及厂商共享同一份HTML约定。这促使了HTML规范化这项联合工做 的开展。
HTML 2.0 (November 1995, see [RFC1866]) was developed under the aegis of the Internet Engineering Task Force (IETF) to codify common practice in late 1994. HTML+ (1993) and HTML 3.0 (1995, see [HTML30]) proposed much richer versions of HTML. Despite never receiving consensus in standards discussions, these drafts led to the adoption of a range of new features. The efforts of the World Wide Web Consortium's HTML Working Group to codify common practice in 1996 resulted in HTML 3.2 (January 1997, see [HTML32]). Changes from HTML 3.2 are summarized in Appendix A
在 IETF的努力工做下HTML 2.01995年11月发布(参见[RFC1866]),该版本编入了截止到1994年末的一些广泛实践经验。1993年的HTML+以及1995年的 HTML3.0提出了更加内涵丰富的HTML版本。尽管这些草案历来没有在标准的层面加以讨论,但它们直接致使了一系列HTML新特性的出现。在1996 年,做为万维网联合会的HTML工做组编撰总结HTML广泛实践经验的结果,诞生了HTML3.2,该版本于1997年1月发布。自从HTML3.2以来 的HTML的变化的整体状况能够在附录A中找到。
Most people agree that HTML documents should work well across different browsers and platforms. Achieving interoperability lowers costs to content providers since they must develop only one version of a document. If the effort is not made, there is much greater risk that the Web will devolve into a proprietary world of incompatible formats, ultimately reducing the Web's commercial potential for all participants.
绝 大多数的人们意识到HTML文档应该在不一样的浏览器和平台上均可以很好的工做。对于内容提供者来讲,若是能够达到这种互操做能力,其提供内容的成本就会降 低,由于他们只须要提供单一版本而不是针对不一样浏览器提供不一样版本的内容。若是不作这样的努力,那么Web极有可能会造成互不兼容的内容格式参杂的局面, 若是这种局面出现,那么对于全部参与方来讲,Web的经济价值和潜力将被极大地下降。
Each version of HTML has attempted to reflect greater consensus among industry players so that the investment made by content providers will not be wasted and that their documents will not become unreadable in a short period of time.
每个HTML的版本都试图最大可能的反应业内各方参与者的关切,以保证内容提供者的投资不会被浪费以及他们的文档不会再短期内变得不可读。
HTML has been developed with the vision that all manner of devices should be able to use information on the Web: PCs with graphics displays of varying resolution and color depths, cellular telephones, hand held devices, devices for speech for output and input, computers with high or low bandwidth, and so on.
HTML在发展过程当中一直保持着一个观点,那就是全部类型的设备都应该可使用Web上的信息。这些设备可使拥有不一样分辨率及颜色深度显示器的我的电脑,移动(蜂窝)电话,手持设备,语音输入输出设备(辅助盲人),拥有不一样网络带宽的计算机等等。