LinksThe 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.
AttributesHowever, 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:
Now, if you load the page in your web browser, you'll see something like this: 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:
And here is what those links look like on a page: In the next section, we'll learn how to link to specific sections of a page. |