Creating HTML links
A link between pages is called an anchor.
You can think of anchors as ``active footnotes.''
Anchors (which appear as blue, red, or otherwise highlighted text) are the real
innovation of the Web. They can point to any type of document, on
any computer in the world. Some examples of what anchors can point to are:
Most anchors consist of a URL, descriptive text or imagery, and an optional
name.
<a href="url"> descriptive text </a>
<a name="string"> descriptive text </a>
<a name="string" href="url"> descriptive text </a>
The name parameter is useful if you have a long document, and want to jump
directly to someplace other than the top.
You specify a location by appending a pound sign (#)
followed
by the name
string after the URL, e.g.:
/afs/cs/project/vision/www/talk/links.html#another
It pays to be clever with URLs when writing HTML documents
It's good to remember that not everybody will be accessing your pages through
a server. WWW client programs are smart enough to use the local filesystem,
if you use the correct abbreviation. The following all point to the
same information:
You could use any of these three URLs when you create a document, but the
best one to use is the shortest one (relative pathname). That way you
don't force everybody to use the server when they read your data, it's
easier to move files around if you decide to reorganize, and you
keep the load low on the server that outside people must use;
everybody's happy.
mwm@cs.cmu.edu
![Prev,](images/previous.gif)