HTML and CSS Reference
To create a link in HTML, you need two things:
The name of the file (or the URL of the file) to which you want to link
The text that will serve as the clickable link
Only the text included within the link tag is actually visible on your page. When your
readers click on the link, the browser loads the URL associated with the link.
The Link Tag: <a>
To create a link in an HTML page, you use the HTML link tag <a>...</a> . The <a> tag
often is called an anchor tag because it also can be used to create anchors for links.
(You'll learn more about creating anchors later in this lesson.) The most common use of
the link tag, however, is to create links to other pages.
Unlike the simple tags you learned about in the preceding lesson, the <a> tag has some
extra features: The opening tag, <a> , includes both the name of the tag ( a ) and extra
information about the link itself. The extra features are called attributes of the tag. (You
first discovered attributes in Lesson 5, “Organizing Information with Lists.”) So, rather
than the opening <a> tag having just a name inside brackets, it looks something like the
< a name = ”Up” href = ”menu.html” title = ”The Twelve Caesars” >
The extra attributes (in this example, name , href , and title ) describe the link itself. The
attribute you'll probably use most often is the href attribute, which is short for hypertext
reference . You use the href attribute to specify the name or URL of the file to which this
Like most HTML tags, the link tag also has a closing tag, </a> . All the text between the
opening and closing tags will become the actual link on the screen and be highlighted,
underlined, or colored blue or red when the web page is displays. That's the text you or
your readers will click to follow the link to the URL in the href attribute.
Figure 6.1 shows the parts of a typical link using the <a> tag, including the href , the text
of the link, and the closing tag.