Hyperlinks - Adam's HTML Planet - Tutorials and Tips on how to create websites using HTML - How to use hyperlinks
Hyperlinks
list of tutorials
next tutorial
Links are what make the World Wide Web a web. You can add links [or "hyperlinks," as they're properly known] that connect from your page to any other accessible site on the Net. Likewise, any other site can link back to you.
When you want to build a link, the first thing you need is the URL of the page you're linking to. You can link to other pages within your site ['relative' links] or to other pages anywhere on the web ['absolute' links]. You have to be careful here about getting the text of the URL exact. For example, if you're linking to one of your pages called PAGE2.HTM and you type the link as PAGE 2.HTM [i.e. with a space in it] it won't work.
Then decide which word [or words] on your page will act as the link. The link will be the 'hot spot', where people can click if they want to go somewhere else. Links are generally underlined, and appear on the browser in a different color than the rest of the text [the default color for links is blue, but this can easily be altered]. Images can also be used as 'hot spots' but we'll look at how to do that in the tutorial on images.
OK then here we go ...
Open the file we've been working on [fonts.htm was the last name we saved it as]
Look at the example below and add the text to your file. Please note that this example assumes that you have followed the tutorials so far and have used Save As each time and will therefore have a file called 'basic1.htm'. If you haven't, download this text file and use Save As to save it as basic1.htm
Save the file [links1.htm]
Preview it in your browser
This is a link back to the <A HREF="basic1.htm">first webpage</A> I made
<P>This is a link to <A HREF="http://www.google.com/">Google</A>, one of the best search engines there is
Let's look at this in a bit more detail.
<A HREF="basic1.htm">first webpage</A>
This is a relative link i.e. it is relative to another file within the same folder as the file with the link on it. The <A bit tells the browser to expect some sort of link [or 'ANCHOR' - which explains the A]. The HREF is shorthand for Hypertext Referrence. The URL of the page being linked to must be in quotes and, as mentioned, must be exact - also, it does make a difference if it's got an HTM or HTML extension.
<A HREF="http://www.google.com/">Google</A>
This is an 'absolute' link. It has the same elements as the previous link, the difference being that it has the complete URL of a file elsewhere on the web. By the way, you don't have to ask permision to link to someone else's webpages nor they to yours. It may, however, be a good idea to contact the designer of sites with similar subject matter to your own to suggest reciprical links as a way of both sites getting more visitors.
Go up to the top of the page to choose where you go next