The Paradox

5: Hyperlinks

In this section, there is only one tag to learn - plus a few elements for that tag. The A tag (for anchor) is what defines a hyperlink. One end of the hyperlink is the 'source' anchor. You see this as a link that you can click on. The other end of the hyperlink is either a file or another anchor. If it's a file, all you have to do is name it, and the browser and server will take care of everything. However, you can also create destination anchors at certain points inside a document, then point a source anchor at it. Kind of like bookmarks within a page. When you click on the source anchor, it will load the destination page (if necessary) and put you at the precise spot in the document that contains the destination anchor.

To define a source anchor, you need to include the 'href' element with the name of the destination. A link to the W3C would look like: <A href="http://www.w3.org/">click here for the W3C</A>. Notice that it is only in the opening tag that you need to specify the elements - the closing tag only has an 'A' in it. This is true of all tags - most of them have optional elements, all of which are put in the opening tag.

If the destination is in the same directory as the source, your 'href' is a lot simpler - it's just the name of the file. I use this all over the place in these pages, because they're all in the same directory. A link to another page in the same directory would look like: <A href="index.html">click here for the tutorial index</A>

If your destination is a named anchor inside a file, there are two steps to carry out, instead of the one for each case listed above. First, you have to create the named destination anchor: <A name="somedestination"> this is the destination </A>. Then, you have to create the source anchor: <A href="filename.html#somedestination"> click here to go to the destination </A>.

This example assumes that your destination is in a different file in the same directory. If the destination is in the same file, you can leave off the 'filename.html' part and just put '#somedestination'. This method can be seen in use in the 'all on one page' beginners tutorial, as a table of contents. If the destination is not in the same directory, you can use the first method - the full domain name - and append '#somedestination' after the end of the filename.

HTML Tutorial index | Beginners Tutorial index
<< Back: Formatting text | Next: Lists >>

The OpenNIC You are using the legacy domain name, paradox.homeip.net, to access this site. This site is also available through the OpenNIC system as www.paradox.null. For more information, please visit The OpenNIC web site. To learn how to configure your computer for OpenDNS, please click here, or see this page to learn how to configure your name server.

This page was last modified Saturday July 06, 2002

Valid HTML 4.01!