HTML and CSS Reference
In-Depth Information
Try iT
In this Try It you learn how to link to another part of the current web page.
Lesson requirements
You will need a previously created web page, a text editor, and a web browser.
step-by-step
1.
Open your text editor.
2.
Open the previously saved
thoreau.html
.
3.
Place your cursor within the opening
<h1>
tag and add a space followed by this code:
id=”top”
4.
After the closing
</p>
tag in each section of quotes, press Enter (Return) and add this code:
<a href=”#top”>Top</a>
5.
Place your cursor before the text
On Living
in the list of categories and add the following code:
<a href=”#living”>
6.
After the text
On Living
in the list of categories, add the following code:
</a>
7.
Repeat steps 5 and 6 for the two remaining categories,
On Topics
and
On Government
, with
these
href
values,
#books
and
#government
, respectively.
8.
Change the
<h2>
tag
On Living
to the following code:
<h2 id=”living”>
9.
Repeat step 8 for the two remaining
<h2>
tags,
On Books
and
On Government
, with these ID
attributes,
books
and
living
, respectively.
10.
Save your document.
11.
In your browser, open
thoreau.html
to view the links, as shown in Figure 8-3.
12.
Click any category link (
On Living
,
On Books
,
On Government
) to test your internal links
and then click Top.