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上的信息。這些設備可使擁有不一樣分辨率及顏色深度顯示器的我的電腦,移動(蜂窩)電話,手持設備,語音輸入輸出設備(輔助盲人),擁有不一樣網絡帶寬的計算機等等。