Community Learning Network
Location: Internet Tools and CD > - Intro to HTML > - HyperLinks Visitor: Login Printable version
CLN Pages
Training
Internet Tools & CD
    - Content Management
    - Intro to HTML
       - HyperLinks
       - Images
       - Tables
       - Web Building Links
       - Appendices
    - Multimedia
    - Skills Inventories
Community pages
Home Page

HTML - Hyperlinks

 

One of the most useful aspects of HTML -- the ability to embed links to other documents and servers within a file. Links are marked by the <A> tag, which indicates a hypertext anchor.

 

 

Say the document you want to link to is in the same directory ("folder" on a Mac) as your current file, and is named "page2.html". A link to it would look like this:

 

Let's go to <A HREF="page2.html">the second page.</A>

 

Here the tag, HREF, stands for hypertext reference. It indicates the name of the reference to which this anchor is pointing. When viewed with a text-only browser the "hot text," or text between the <A></A> tags, is highlighted. When viewed with a graphical browser the hot text is usually a different colour and underlined. In the example above the hot text is the phrase "the second page."

 

 

In this example, the anchor can point to a URL.

 

The <A HREF="http://www.vcn.bc.ca/">Vancouver CommunityNet</A> Web site.

 

When pointing to a local page or a site on the other side of the world, always remember to close the anchor with a </A> tag! If you don't then the rest of your document will be an anchor. Also, be absolutely certain to enclose the filename or URL in double quotation marks. If you don't then the link will not work with many browsers!

 

 

A common application of a link is a hot piece of text that allows the user to send an email message to the author of the page. You simply use the A HREF technique as above, only you use a "mailto:" URL.

 

Send fan mail to <A HREF="mailto:web-admin@vcn.bc.ca">theCommunityNet Web administrator.</A>

 

 

If you have a number of text files you want to make available on the Web, it can be annoying to have to convert those files to HTML first. Here's a quick shortcut.

 

All Web browsers are capable of diplaying ordinary text files as well as HTML files. Make sure the text file you want displayed ends in the suffix ".txt" and that it has line breaks (returns) inserted into it every 70 columns or so. Link the file in as you would any other file.

 

Display a <A HREF="plaintext.txt">plain text</A> file.

Your browser will then display the plain text file as-is. It's essential that you have line breaks already inserted into the file as browsers will not wrap long lines of text.