(X)HTML Tutorial

Links

The hyperlink (or link for short) is the feature that defines web pages as hypertext. Links are used by the reader to navigate to other web pages or to different portions of the page which are not necessarily displayed on the screen without scrolling. A link is designated by enclosing a text or image inside the <a> (anchor) tag. To designate the destination of the link, use the href attribute:


   <a href="http://www.csun.edu/~sk36711/WWW/tutorials/introduction.html">
   Link to the Tutorial Introduction</a>

This will link to another web page (in this case the introduction to this tutorial). Notice that actual text displayed in the link is what you put between the opening and the closing tags of the <a> element:

Link to the Tutorial Introduction

You can also use @name to designate a point of your own web page as the destination of your link. For instance:


   <a name="top"></a>

You can then insert a link elsewhere in your document which looks like this:

 
   <a href="#top">Return to Top</a>

The user who clicks on this link will be taken to the point in the document where the anchor named "top" is found. This is sometimes called a bookmark. It is possible to link to bookmarks both in the same web page or in another one.

Pay attention to the syntax. The name of the destination anchor is given at the point of the link's destination. In the link itself, the name of the anchor is preceded by # inside the href attribute.