|

As weve seen
before, Internet Web pages are connected together using links.
Links, like text formatting,
are controlled by tag pairs. Like a real "link" between
two objects, like a chain, rope, or cable, HTML links must have
both a base to attach to and something else to connect to.
There are three general
formats for links:
- <a href=URL>
A Link </a>
- <a name=Name>
A marker </a>
- <a href=URL#Name>
Link to a marker </a>
Let's take a look at
the terms used in each of these tags:
- a = Anchor.
This tells the browser that the enclosed text is a link.
- href = Hypertext
REFerence. This tells the browser that the link points
to a URL.
- name = Name.
This tells the browser that link is a marker point
in the document (like a bookmark)

Let's try adding a
link to our existing page. Modify the code so it looks like this:
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
This is some text!
<pre>This is preformatted text</pre>
This web page is ©2001 by Me.
This should be a few spaces over
to the right.
<H1>This is going to be big text on its own line.</H1>
<font face="Arial" size=5>This will be almost
as big, and in Arial font!</font>
<br>
<div align="right">This should be on the next
line and on the right side of the screen.</div>
<br>
<center>This should be centered text.</center>
<br>
<br>
<hr width=75% size=6 align="left">
<br>
<br>
<br>
<div align="center">So should this, but several
more lines down the page.</div>
<br><br>
<a href="http://www.tmlp.com">Click here to go
to the TMLP Home Page.</a>
</body>
</html>
Load the page in your
browser. It should look something like this:

Notice the words "Click
here to go to the TMLP Home Page" appear in blue with a line
under them. This is an indication that the words are a link. Click
your mouse on the words and your browser (if you are currently
connected to the Internet) should attempt to go to the TMLP Home
page.
Links
can either be absolute or relative.
An absolute
link details the exact location of a document on the Internet
(for example "http://www.tmlp.com") It's always
all right to use absolute links when you create links, even if
they aren't necessary.
A relative
link describes the location of a document on the Internet relative
to the page the link is on. These should only be used when the
document being linked to is on the same web site as the document
you are creating the link from.
For example,
the URL of the document you are currently looking at is http://www.tmlp.com/tutorial/coursep12.htm
The previous
page in this online tutorial has a URL of http://www.tmlp.com/tutorial/coursep11.htm
If you
wanted to create a link from this page to the previous page, you
have two choices:
- An absolute link.
This would appear as follows in the text: <a href="http://www.tmlp.com/tutorial/coursep11.htm">Click
here to go back to the previous page</a>
- A relative link.
Since the two pages are on the same site (www.tmlp.com) and
in the same directory ("tutorial" directory), all
you need to do to link the two together is to enter the following
line in the code: <a href="coursep11.htm">Click
here to go back to the previous page</a> Your browser
will automatically know that since you are currently on a page
on the website www.tmlp.com in the directory called "tutorial,"
the page you are linking to must also be on www.tmlp.com
in the directory "tutorial."
The disadvantage to
using relative links: you can only use them to link to other pages
on the same site.
The advantage to using
relative links? They take less time to type than absolute links
when you are creating the page. It may not seem like much extra
work now, but when you create a site with hundreds of pages, saving
a few extra seconds typing the abbreviated versions of the full
URL's really begins to add up.
Next, we're going to
discuss creating lists of items on your web pages.
|