Beginners guide to HTML

Lesson 8 - Advanced Links

Links to Other Sites

To link to another site the link has to have the full URL (Uniform Resource Locator), typically this looks something like:

<a href="">Linking text</a>

The first part the http: tells the system what type of link it is, most will be http ie web page links.

The next part gives a unique name to some site, many will begin www, but not all. Site names are NOT case sensitive, ie is the same as WWW.WAVWEBS.COM

The next part loonies/friends.html gives the location of the file on that server, it may have directories in it. File names are USUALLY case sensitive.

You can add a label at the end to locate part of the far page, but beware pages change - it is normally unwise to link to a label on someone else's site.

Links to send Mail

To set a link for someone to send you mail can be put on a website. This might be something like:

Mail to <a href=""></a>

This uses the URL prefix mailto: it is customary to give the full email address as the link contents for mail to links, as some people can't click on mail links.

Links For Pictures

The source of a picture can be as complicated as any link to another page. Pictures can come from other sites. If you have a thumbnail (small picture) as a link to a larger picture then the following may be of use:

<a href="Larger_Image.jpeg"><img src="Smaller_Image.jpeg" border=0 width=50 height=80></a>

This puts a link round the image to the larger image, note the smaller image gives its height and width, the larger image is a whole page. Sometimes this is clearer as:

<a href="Larger_Image.jpeg"><img src="Smaller_Image.jpeg" border=0 width=50 height=80><br> Larger Image (90K)</a>

Here the link indicates that the picture is a link and gives the size of the larger image.

Links To Programs / Scripts

A link to a "page" or an "image" can be to program that generates a page on the fly. typically such a link is to program.cgi the .cgi is needed for many servers to tell it to run the program. These links often need parameters , these are often in the following form:

<img src="counter.cgi?name=henry&width=5> The ? separates the program from its parameters. There are lots of ways to put parameters. Links to programs/scripts do not work locally they need the real internet.

File Names

It is a good practice to have the main page in each directory called index.html. If someone looks at the directory on the internet without specifying a file, then if there is a file called index.html this is shown, if not then they get a directory listing - rarely what you want.

| Back to the index | Previous Lesson | Exercises

Home | Advice | Hosting

Updated 17th of October 2002