Hypertext Links

 

Linking to Other Documents Using the Anchor Element<A> </A>

In this lesson, we will add one of the most useful tools which is available in HTML, the concept of linking to other web pages and documents.

The most useful aspect of writing in HTML is its ability to link text to other texts, a concept commonly known as hyperlink.. HTML uses an anchor element <A></A> to link documents together. Every anchor element includes the following elements:

Sound complicated? In practice, it really isn't. Here's a typical anchor tag:

<A HREF="http://wtc.cc.tx.us">Western Texas College</A>

As you can see, the tag begins with an <, the basic element of every anchor tag (the 'A' is for Anchor). After a single space, the < is followed by HREF="http://wtc.cc.tx.us">. The HREF=" section tells the computer that this tag will link the document to another document. HREF is an abbreviation for Hyperlink REFerence. The next set of information called the link destination, "http://wtc.cc.tx.us", is the name of the document to which it should connect, which in this case is a web page at wtc.cc.tx.us. Addresses such as these are often called Uniform Resource Locators, or URL's. The > at the end of the address simply tells the computer that the address is over. Always include destination URLs in anchor tags inside quotation marks.

Next, we add text which says Western Texas College. This is the information that will actually appear on the screen. The information is known as a link label. For when you select it in your web browser by clicking it with a mouse,  it will connect you to the address (in this case, http://wtc.cc.tx.us). Finally, </A> is added at the end of the tag to tell the computer that the anchor element is complete.

When you add an URL and link to someone else's webpage, it is called an Absolute hyperlink

While the anchor and the closing anchor in this kind of tag remain constant, the other two pieces, the URL and the link, are adjustable. URLs can include practically any file on the Internet, such as a web site or an email address, though most commonly you will link your documents to web sites. Here are some examples:

A link to USA Today
<a href="http://www.usatoday.com">USA Today</A>

DO NOT LEAVE OUT THE QUOTATION MARKS IN AN ABSOLUTE ANCHOR TAG. IT WILL CAUSE MAJOR PROBLEMS!


If you are linking to a file within your own webpage, you do not have to enter the complete URL <a href="http://www.oocities.org/tcanada1301/basic.html") Linking to your own work within your website in called a relative link and you only have to enter the file name in your start anchor tag <a href="basic.html">My Basic Assignment</a> You do not HAVE to include relative links in quotation marks but it is a good habit to always use them. 


To mail a message to the me you would replace the http: with mailto:
<a href="mailto:tcanada@wtc.cc.tx.us">Tonya Canada</A>

 MAILTO: is used if you want to refer to an email address, where 'http:' represents a web page. Other options are 'news:', 'telnet:' and 'ftp:'.

If I add an email hyperlink, when someone clicks on my name on my webpage, if their browser email software is configured with an email address, it would open with the email already addressed to tcanada@wtc.cc.tx.us 

 


Hypertext anchors and links may be the most important HTML code you'll learn, so review this lesson and make sure it makes sense to you.

1