The chief power of HTML comes from its ability to link text and/or an image to another document or section of a document. A browser highlights the identified text or image with color and/or underlines to indicate that it is a hypertext link (often shortened to hyperlink or just link).
HTML's single hypertext-related tag is <A>, which stands for anchor. To include an anchor in your document:
Here is a sample hypertext reference in a file called index.html:
<A HREF="preference.html">Preferences</A>
This entry makes the word Preferences the hyperlink to the document preference.html, which is in the same directory as the first document.
The World Wide Web uses Uniform Resource Locators (URLs) to specify the location of files on other servers. A URL includes the type of resource being accessed (e.g., Web, FTP), the address of the server, and the location of the file. The syntax is:
scheme://host.domain [:port]/path/ filename
where scheme is one of
The port number can generally be omitted. (That means unless someone tells you otherwise, leave it out.)
For example, to include a link to this primer in your document, enter:
<A HREF="http://geocities.datacellar.net/Hollywood/Heights/4734/preference.html"> Preferences</A>
This entry makes the text Preferences a hyperlink to this document.
There is also a mailto scheme, used to hyperlink email addresses, but this scheme is unique in that it uses only a colon (:) instead of :// between the scheme and the address. You can read more about mailto below.
Anchors can also be used to move a reader to a particular section in a document (either the same or a different document) rather than to the top, which is the default. This type of an anchor is commonly called a named anchor because to create the links, you insert HTML names within the document.
This guide is a good example of using named anchors in one document. The guide is constructed as one document to make printing easier. But as one (long) document, it can be time-consuming to move through when all you really want to know about is one bit of information about HTML. Internal hyperlinks are used to create a "table of contents" at the top of this document. These hyperlinks move you from one location in the document to another location in the same document. (Go to the top of this document and then click on the Links to Specific Sections hyperlink in the table of contents. You will wind up back here.)
You can also link to a specific section in another document. That information is presented first because understanding that helps you understand linking within one document.
Suppose you want to set a link from document A (index.html) to a specific section in another document (preference.html).
Enter the HTML coding for a link to a named anchor:
index.html: In addition to the many file, Preference is also home to <a href="preference.html#ANP">Preferences</a>.
Next, create the named anchor (in this example "preference") in index.html:
<H2><A NAME="preference">Preferences</a></H2>
Be sure to include the <A NAME=> tag at the place in your document where you want the link to jump to (<A NAME="ANP">Acadia National Park</a>).
Named anchors are particularly useful when you think readers will print a document in its entirety or when you have a lot of short information you want to place online in one file.
You can make it easy for a reader to send electronic mail to a specific person or mail alias by including the mailto attribute in a hyperlink. The format is:
<A HREF="mailto:tashu74@yahoo.com">Name</a>
<A HREF="mailto:tashu74@yahoo.com"> Taku Ashu</a>