URLs and Links - Pointing Here and There

Create a link using a URL.


The chief power of HTML comes from its ability to link from one document to another.
We will learn about how to tell the browser what to do when somebody clicks on them.

A link is specified by the generalized format:

<A HREF="URL">Link Text</A>

In links, the "A" represents the word "Anchor."

The "A" tag has the attribute, "HREF", which stands for Hypertext REFerence.

The most important part of the link is the name of where you want to jump to
when the user clicks on the link. You specify where to go using a URL.
A URL simply stands for "Uniform Resource Locator." This is just jargon
for the address of the page you want that you want to link to.
A URL to a file on another computer looks like this: http://www.lesley.edu/

The URL is also put into quotes. So, all links begin with code that looks like this:
<A HREF="http://www.lesley.edu/">link to lesley home page</A>

This would look like this in a browser:

link to lesley home page

Any text contained between the < and > brackets will be visible to the reader and highlighted
by colored underlining. When the text is clicked, the reader will be taken
to the location specified in the URL.

Here is an example of the code for linking to the Tech Ed program site.
(Don't panic if you don't understand it--just try it now. We will review again later!)

<A HREF="http://www.lesley.edu/soe/tech_in_ed/techined.html">Lesley Tech in Ed Web Site</A>

Put this code in your document and save it, then view the document in your browser.

It should look like this: Lesley Tech in Ed Web Site

When you click on it, you should see the specified page on the Lesley Web Site.

You can also link from the current document to a file located in the same directory.
To link to another HTML document in the same directory as the current file,
all you need is the file name in the URL. So, if the file "here.htm"
is in the same folder, you would create the link with this code:

Go <A HREF="here.html">here</A>!

It would look like this in a browser: Go here!

When you click on "here" the browser should jump to the file named "here.htm"

If the file is on a different machine than the current file,
the link would need to contain the file's full address in the URL.
It would look like this:

Go <A HREF="http://www.server.edu/here.html">here</A> !

Link Recipe

First, find a URL on the Internet on another server that you would like to link to from your document and write down the full address that appears in your browser. Then, open up your document and add a link to the full URL. In order to make a link:

  1. Decide where you would like the link to lead (for example, a URL)
  2. Decide what text you would like to be the link (i.e. the part underlined)
  3. Construct the code like this <A HREF="file.htm">text link</A>
  4. Start the link with <A HREF=
  5. Add where you want the link to go in quotes with a full address "http://place.edu/filename.html" or just the name of a file on the same server "filename.html"
  6. Add a closing >
  7. Add the text for the link in the document (what the reader will see)
  8. Add the ending anchor tag </A>
  9. Save the page

  10. Load your page in a browser and check the link to see if it works

See Basic Links Castro pp. 107-109 (alt. pp. 117-119)


Lesley ECOMP 6009   © 1999 Mary Hopper mehopper@world.comUpdated 12/01/99