HTML Tutorial
.
  Hypertext Links.
.
The ANCHOR tag surrounds a piece of text or a graphic that provides a hypertext link. An ANCHOR tag can be used to link to another web page, to another part of the same web page or to another web site entirely. The HYPERTEXT attribute takes as its value the path of the document to which the link refers. Add the code below to your document.
Unlike other tags which
do not require attribute
values, the ANCHOR tag
must have the HYPERTEXT
LINK attribute defined.
<P><A HREF="tutorial.html">Alice</A></P>
The word Alice now provides a link to the first web page that you constructed.

Graphics can also be used to provide links. To achieve this, the ANCHOR tag is placed around the IMAGE tag that specifies the graphic. Right click on the image shown and copy it to the folder containing your html files. Now open the file tutorial.html in your text editor and add the following code.

<P><A HREF="tutorial2.html"><IMG SRC="rabbit.gif"></A></P>

Clicking on the graphic should now link back to the second web page that you constructed.

By default a border is placed around image links to show that the image is a link. The border can be removed by setting the BORDER attribute of the IMAGE tag to 0.
To link to another web site, specify the url of the site in the HYPERTEXT REFERENCE attribute. For example, to link to Yahoo, add the code shown.
<P><A HREF="http://www.yahoo.com">Yahoo</A></P>
Links can also be used to link to different parts of the same document. This is achieved by assigning a name to the HYPERTEXT REFERENCE attribute and then placing an ANCHOR tag around a piece of text that you wish to jump to. This second ANCHOR tag uses the NAME attribute instead of the HYPERTEXT REFERENCE and takes as its value, the same name assigned to the first tag's HYPERTEXT REFERENCE.
Place the ANCHOR tag shown around the heading at the beginning of your tutorial2 document.
<H1><A HREF="#bottom">Through the Looking Glass</A></H1>
<P><A NAME="bottom">Bottom</A></P>
Now place the code shown on the left at the bottom of the document.
Of course this kind of link is more commonly used in a long web page where readers may wish to refer to another part of the document without having to scroll all the way down. To see the effect of this internal link, you could copy the text at the beginning of your document and paste it a number of times at the bottom.

<< Back
.