Thanks for visiting IT-arama

This site proudly sponsored by:
Contact us here
Other ITarama affiliates:
ITarama recommends:
Firefox 2

Linking

When you mention a link or linking when referring to a Web page, you are more properly referring to a "hyperlink" or "hyper linking". What is this voodoo you ask? Simply put, hyper linking is what you perform on a Web page when you click on a bit of underlined text (or a photo or an image) and it takes you somewhere else.

Hyper linking was one of the earliest uses of the Internet. In fact, it was created by university researchers as a way to take someone perusing a document directly to another work that was quoted or cited instead of just referring to it. The "hyper" part came from the fact that it happened virtually instantaneously.

How can I too become a hyper linker you ask? Look below and you shall see.

There are two main flavors of hyper links. They are absolute and relative.

Absolute linking

An absolute link is one that refers to a URL (Uniform Resource Locator also known as a Web address) in the most specific way possible. For example, if you wanted to add a link to your site to the popular search engine Google, you would do it like so:

<a href="http://www.google.com">Here is a link to the Google search engine</a>

And it displays like this:

Here is a link to the Google search engine

The "a" is the "anchor" tag, the tag used for linking. The "href" part stands for "hypertext reference. And the part after the equal sign between the double quotes is Google's specific Web address. The "http" stands for "hyper text transfer protocol" which is the method of file transfer used.

This method of writing links may be used for links which refer to pages outside or within the Web site in which they reside. In other words, you can use absolute linking to take a Web surfer to another site on the Web or to another location within your own site.

Relative linking

Relative linking is similar to but simpler than absolute linking. It can only be used however for linking within a Web site. A relative link that will take you to our HTML Lists page is written like this:

<a href="lists.asp">Go to our Lists page</a>

And it appears like this:

Go to our Lists page

Notice how this link is nearly identical to the absolute link we saw earlier. The main difference being that we needed to refer only to a file name as opposed to an entire URL. We can do this only because the file we are referring to, in this case "lists.asp", is in relatively close proximity to the page we are linking from. In fact, to use the relative link shown above, the file referred to (lists.asp) must reside in the SAME folder on the server (or the local machine) as the page the link is on.

To use images instead of text as links, you just have to replace the text with an image (img) tag like so:

<a href="http://www.985computing.com"><img src="images/985logo.gif" align="middle" border="0" alt="Go to 985 computing.com" width="150" height="51" /></a>

Which displays like so:

Go to 985 computing.com

By using the border="0" attribute, we prevent the image from having a border drawn around it. A border normally would indicate that this image is a link. The other thing to notice is that the image source (img src) is "images/985logo.gif". This indicates that the image called "985logo.gif" is located in a folder called "images" that is one level ABOVE the folder in which the page calling it resides.

© 2000 - 2010 by 985 computing LLC
ITarama - The home of short sweet Web tutorials