Links

The most basic thing about the Web, the thing that really makes it the Web, is the ability to create hyperlinks to other pages and other sites. This is done with the A tag. (A stands for "anchor." You'll find out why, in the next section.) Place the opening and closing A tags around the text you wish to make into a link.

<A>Seattle Times</A>

Attributes

However, just using <A> and </A> by themselves won't do much. We need to add some additional information to this tag before it will function. The additional items are called attributes. As I mentioned in Chapter One, attributes are used to modify the effects of a tag in different ways.

The most important attribute of the A tag is HREF. HREF stands for "Hypertext REFerence." This is used to specify the URL, or address, of the targeted document. Let's say that we want to make a link to http://www.seattletimes.com/. Here's how we use the HREF attribute to do this:

<A HREF="http://www.seattletimes.com">Seattle Times</A>

Now, if you load the page in your web browser, you'll see something like this:

Seattle Times

This link should be highlighted in your web browser. If you click on it, you'll go to the Seattle Times web page.

Did you notice that the HREF goes in the opening tag, but is not used in the closing tag?

Here are some more samples of link code:

<P><A HREF="http://www.seattleweather.com/">seattleweather.com</A></P>

<P><A HREF="http://www.yahoo.com/">Go to Yahoo!</A></P>

<P><A HREF="http://www.slashdot.org/">Slashdot, News for Nerds</A></P>

And here is what those links look like on a page:

seattleweather.com

Go to Yahoo!

Slashdot, News for Nerds

In the next section, we'll learn how to link to specific sections of a page.


<<-------- p r e v // a i w e b // n e x t -------->>