To link to another web page use the anchor element, <a>.
<a href="http://www.some-other-web-site.co.uk/home.html/">Click here!</a>
The href attribute specifies the full URL, the text between the tags is the highlighted text to be clicked on.
The <base> element can be used to specify a base URL for all links, including images, in the page.
This means that relative addresses can be used throughout the page.
The <base> element must be placed in the <head> section. Using this, the above example could be written:
<head>
<base href="http://www.some-other-web-site.co.uk" />
</head>
........
<a href="home.html/">Click here!</a>
By default, a new web page will open in the current window. If you wish to to open the page in another window use the target attribute with a value of "_blank".
<a href="home.html/" target="_blank">Click here!</a>
It should be noted that this attribute is deprecated in XHTML Strict.
TopTo link to another page on the same server it is not necessary to provide the complete Internet address. If two pages are in the same folder you can just use the name of the file.
<a href="pageTwo.html">Next</a>
This works equally well with local files on your computer as well as on a web server. Folders relative to the current one may also be accessed without a complete address or path being specified.
<a href="nextPage/pageTwo.htm">Next</a>
In this example pageTwo.htm is located in a sub-folder called nextPage.
<a href="../index.htm">Up</a>
Here, the file index.htm is located in the parent folder of the current one.
<a href="../folder2/index.htm">Across</a>
This page is located in a sibling folder, folder2, to the current one.
TopA different use of the anchor element, is needed to make these links.
A name must be given to a reference point in the page, for example, <a id="top"></a>.
The link is then made by specifying the anchor name in the href attribute,
<a href="#top">Up to Top</a>
Up to Top will be the highlighted link to click on to go to the reference point 'top'. Note that the use of the '#' sign in the href attribute signifies that this a reference point within the current page.
Note that XHTML standards require the use of the attribute id instead of name which was previously used in HTML.
In order to conform to these standards and be backward compatible,
both attributes can be used in the anchor tag.
<a name="top" id="top"></a>
Any element may be used as the 'bookmark' but only the id attribute may be used in this case.
In this case, the reference link is a combination of the address or page name and anchor name.
<a href="Appendix.html#glossary"></a>Top
Instead of clicking on some hyperlink text, the text can be replaced by an image. If the image is not in the current directory, an absolute or relative path can be used to specify the location of the image file as seen in the following example:
<a href="#top"><img src="../images/up.gif" alt="Go to Top of Page"/></a>
This image has replaced the usual Top text.
This can be done by specifying the email address in the href attribute.
A new email window for the default email application is opened with the address in the link populating the 'To' field.
<a href="mailto:xavier@strawberrydog.co.uk">Email me!</a>
Top