Home > Chapter Review and Exercises > Chapter 6 - Adding Links
Chapter 6 introduces the anchor <a> element for adding links to text. It first looks at external links that use complete URLs, followed by relative links that use only a pathname. UNIX pathname syntax is introduced over several steps, making up the bulk of the chapter. Linking within a page (to fragments), targeting new browser windows, and mail and telephone links are also covered.
In Chapter 6, you will learn the following:
Making a link using the anchor (a) element
Linking to external web pages with a complete URL
Linking to files on the same server using relative pathnames in UNIX syntax (within a single directory, down into subdirectories, and back up to higher directory levels)
Linking to fragments within a web page
Targeting new browser windows
mailto and telephone links
anchor
The HTML element (a) that creates a hyperlink
absolute URL
A complete URL that includes the protocol and domain name in addition to the path to the resource
relative URL
The location of a resource on the same server identified relative to the location of the current document
external link
A link to a document or resource on a server other than the current server
pathname
The notation used to point to a particular file or directory in which directory levels are separted by slashes (/)
root directory
The directory that contains all of the files for the site
site root relative link
A relative URL beginning with a slash (/) that is always relative to the root directory for the site
fragment
A part of a web page
fragment identifier
An id value given to an element that assigns a name to the fragment so it can be referenced by a link
mailto link
A link that opens a pre addressed new mail message in the browser’s designated email program
6-1: Make an external link
We start out creating a basic link to an external web page.
6-2: Link in the same directory
This is the first of several exercises that get readers familiar with relative links.
We start simply by linking to a file that is in the same directory as the current
file.
6-3: Link to a file in a subdirectory
The next step is linking to a file that is within a subdirectory by including the
directory name in the path.
6-4: Link two directories down
Building on the previous exercise, now we link to a file in a subdirectory within
the subdirectory.
6-5: Link to a higher directory
This is a chance to try out the ../ convention for backing up a directory level.
6-6: Link up two directory levels
Here we link to a file that is two levels up in the hierarchy using ../../
6-7: Try a few more
Students are given five more opportunities to try out relative pathnames based on the sample directory structure.
6-8: Linking to a fragment
In this exercise, students identify fragments in a long glossary with the id attribute and make letters at the top of the page link to them.