Hypertext Links

Hypertext links offer a way to move not only within a document but between different documents. You can also use hypertext links to access electronic mail. Each hypertext link tag begins with an anchor which is simply a tag that defines the nodes of the hypertext links. Every hypertext link will begin with some form of the anchor tag <A something> and end with </A>. The method of activating a link is browser-dependent. Graphical browsers usually require you to click on the link with the mouse.

Moving Between Documents

Probably the most common use of hypertext links is to move between different documents or pages. The opening anchor tag in this case is <A HREF="URL of destination file">. Next you write the text of the hypertext link. Finally, you end with the closing anchor tag </A>. The URL of the HTML Tutorial Home Page is

http://www.obliquity.com/computer/html/index.html

so the source code for the hypertext link at the bottom of the page which sends you back to this home page is

<A HREF="http://www.obliquity.com/computer/html/index.html">HTML 
Tutorial Home Page</A>
Activating the highlighted or underlined text will send you to the HTML Tutorial Home Page.

Moving Within a Document

You can also use hypertext links to move to different locations within a document. This ability can be particularly useful if the document is very long. This link will take you to the bottom of this page. The tag used looks like <A HREF="#identifer">text</A>. The source code for the preceding example is
<A HREF="#bottom">This link</A> will take you to the bottom of this page.
In this case, the destination is some unique identifier (bottom in this example) preceded by a hash # mark. You mark the destination with a tag <A NAME="identifier">text</A>. Note that the identifer is not preceded by a hash mark. In our particular example, the destination source code is
<A NAME="bottom" HREF="#top">This link</A> will return you to the
<STRONG>Moving Within a Document</STRONG> section.
Note that it is permissible to have both HREF and NAME attributes in the same anchor tag.

Electronic Mail

You may wish to make it possible for readers of your World Wide Web pages to be able to send you electronic mail messages (or email you). You can do this by using the tag <A HREF="mailto:your email address">hypertext message</A>. When someone activates this link, it will start up their electronic mail system with you as the automatic recipient of the message.

Warning : Unfortunately, there are those who abuse such links by sending out robots which look for mailto: links, copy the email addresses, compile them into mailing lists, and then sell them for profit. Use mailto: links at your own peril and do not list anyone else's email address on your web pages without their permission.

Images as Hypertext Links

It is possible and even useful to use small images as hypertext links. You simply embed the image tag within the hypertext link anchors. For instance, if you activate this picture

Image

you will end up on the page describing images. The source code for this link is

<A HREF="http://www.obliquity.com/computer/html/images.html">
<IMG SRC="http://www.obliquity.com/computer/html/tinyball.gif" ALT="Image"
WIDTH="100" HEIGHT="100"></A>
This link will return you to the Moving Within a Document section.
[HTML Tutorial Home Page] [Previous Page] [Next Page]
Obliquity Valid HTML 3.2! Copyright © 1995-2007 by David Harper and L.M. Stockman
All Rights Reserved
Designed and maintained by Obliquity
Last modified on 1 January 2007
https://www.obliquity.com/computer/html/links.html