Contents
2 HTML 4 简介
本章内容
- 什么是万维网(World Wide Web)?
- 关于统一资源标识符URIs的介绍
- 分段(段落)标识符
- 相对的统一资源标识符URIs
- HTML是什么?
- HTML简明历史
- HTML 4
- 国际化
- 访问性
- 表格(Tables)
- 组合文档
- 样式表(Style sheets)
- 脚本(Scripting)
- 打印(Printing)
- 用HTML 4 撰写文档
- 结构与展现隔离
- 设想一下全世界人民都可以访问的Web
- 帮助用户代理(浏览器)采用增量方式进行展现输出
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.
2.1 什么是万维网(World Wide Web)?
万维网(World Wide Web或者Web)是一个信息资源的网络。Web网络依赖三个重要的机制来支持各种可能受众对这些信息资源的快速高效访问。这三个机制如下:
- 在Web上定位信息资源的统一命名模式(例如:统一资源标识符URIs)。
- 用于在Web上存取这些进行了统一命名的信息资源的协议(例如: HTTP)。
- 可以在资源之间进行方便导航的超文本内容(例如:HTML)。
这三种机制之间的关联关系在本规范内是明显且无处不在的。
Every resource available on the Web -- HTML document, image, video clip, program, etc. -- has an address that may be encoded by a Universal Resource Identifier, or "URI".
URIs typically consist of three pieces:
Consider the URI that designates the W3C Technical Reports page:
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:[email protected]">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:[email protected]">Joe Cool</A>.注释.大多数读者可以对"URL"比较熟悉,而对"URI"比较陌生。 URL 是更加通用的URI命名模式的一个子集。
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 image
<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上的信息。这些设备可以使拥有不同分辨率及颜色深度显示器的个人电脑,移动(蜂窝)电话,手持设备,语音输入输出设备(辅助盲人),拥有不同网络带宽的计算机等等。