HTML - The Basics Tutorial
Part 4 - Hyperlinks and Bookmarks
You should know how what a hyperlink is and what it is used for. If you do not, a hyperlink is a piece of text you click to be taken to another page. A bookmark is a way of bookmarking a point on your page so that you can hyperlink to it.
The <a> Tag
The <a> tag is used when creating hyperlinks and bookmarks. It stands for anchor. The functions are explained more fully below.
To create a hyperlink you need to use the href variable of the <a> tag. Href stands for Hyperlink REFerence. To make a piece of text or an image into a hyperlink you contain it in:
<a href="pageurlhere">Text Goes In Here</a>
Hyperlinks can specify several things:
|Web Page or Site||<a href="http://www.webaddress.com/folder/page"> |
|Local Page||<a href="pagename.html"> |
|Local Page In A Folder Level Below||<a href="foldername/pagename.html"> |
|Local Page In A Folder Level Above||<a href="../pagename.html"> |
|Open E-mail Program With E-mail Addressed||<a href="mailto:firstname.lastname@example.org"> |
|Bookmarked Section||<a href="#bookmarkname"> |
|Bookmarked Section In Another Page||<a href="pagelocation.htm#bookmarkname">|
Bookmarks on a page are very easy to make as they also use the <a> tag. Instead of changing the href variable you use the name variable. For example:
<a name="top">The First Text In The Page</a>
Will create a bookmark called top in the text which the tag surrounds. An image can also be contained in this tag. You can then link to this using a standard hyperlink:
<a href="#top">Back To Top</a>
You can name bookmarks anything you like. Bookmarks are very useful on pages which are very long as they can be used to quickly go to another part of the page.
In the final part of this tutorial I will show you how to add images to your page and how to set background colors and images.
1999 - 2001 David Gowans