intervening spaces. Although very useful for tables and forms,
text turns out pretty dull; the popular browsers render the block in a monospace typeface. Section 4.7.5, "The
Tag" in Chapter 4
2.5 The Flesh on an HTML
2.7 Hyperlinks
Document
Chapter 2
HTML Quick Start
2.7 Hyperlinks
While text may be the meat and bones of an HTML document, its heart is hypertext. Hypertext gives users the ability to retrieve and display a different document in your own or someone else's collection simply by a click of the keyboard or mouse on an associated word or phrase ( hyperlink ) in your HTML document. Use these interactive hyperlinks to help readers easily navigate and find information - in your own, or others' collections - of otherwise separate documents in a variety of formats, including multimedia, HTML, and plain ASCII text. Hyperlinks literally bring the wealth of knowledge on the whole Internet to the tip of the mouse pointer.
To include a hyperlink to some other document in your own collection or on a server in Timbuktu, all you need to know is the document's unique address and how to drop an anchor into your HTML
document.
2.7.1 URLs
While it is hard to believe, given the millions, perhaps billions, of them out there, every document and resource on the Internet has a unique address known as its uniform resource locator (URL; commonly pronounced "you-are-ell"). A URL consists of the document's name preceded by the hierarchy of directory names in which the file is stored ( pathname ), the Internet domain name of the server that hosts the file, and the software and manner by which the browser and the document's host server communicate to exchange the document ( protocol ): protocol://server_domain_name/pathname Here are some sample URLs:
http://www.kumquat.com/docs/catalog /price_list.html price_list.html
http://www.kumquat.com/
ftp://ftp.netcom.com/pub/
The first example is what's known as an absolute or complete URL. It includes every part of the URL
format - protocol, server, and the pathname of the document.
While absolute URLs leave nothing to the imagination, they can lead to big headaches when you move documents to another directory or server. Fortunately, browsers also let you use relative URLs and automatically fill in any missing portions with respective parts from the current document's base URL. The second example is the simplest relative URL of all; with it, the browser assumes that the price_list.html document is located on the same server, in the same directory as the current document, and uses the same network protocol.
Relative URLs are also useful if you don't know a directory or document's name. The third URL
example, for instance, points to kumquat.com 's web home page. It leaves it up to the kumquat server to decide what file to send along. Typically, the server delivers the first file in the directory, one named index.html , or simply a listing of the directory's contents.
Although appearances may deceive, the last FTP example URL actually is absolute; it points directly at the contents of the /pub directory.
2.7.2 Anchors
The anchor () tag is the HTML feature for defining both the source and the destination of a hyperlink.[ 4 ] You'll most often see and use the tag with its href attribute to define a source hyperlink. The value of the attribute is the URL of the destination.
[4] The nomenclature here is a bit unfortunate: the "anchor" tag should mark just a destination, not the jumping off point of a hyperlink, too. You "drop anchor"; you don't jump off one. We won't even mention the atrociously confusing terminology the HTML
standard uses for the various parts of a hyperlink except to say that someone got things all "bass ackwards."
The contents of the source tag - the words and/or images between it and its end tag - is the portion of the HTML document that is specially activated in the browser display and that users select to take a hyperlink. These