XHTML Lesson 6: Links to Other Pages

The most essential element of the Web is the ability to link from one page to the next. Every Web site needs navigation links to allow the reader to navigate. This lesson will show you how to create links to Web pages within your Web site.

Assignment:

Type the code below into any text editor and save it with the name "lesson06.html" in your "mySite" folder. You may view the completed lesson in a new window by clicking here . After you create this page, open it in your Web browser.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML Lesson 6: Links to other pages</title>
</head>
<body bgcolor="white">
<h1> Links to Your Other Pages</h1>
<p>Every site needs navigation links to help the reader explore the content. So far you have created several pages. This page will contain links to those pages.</p>
<p><a href="lesson01.html">Lesson 1</a></p>
<p><a href="lesson02.html">Lesson 2</a></p>
<p><a href="lesson03.html">Lesson 3</a></p>
<p><a href="lesson04.html">Lesson 4</a></p>
<p><a href="lesson05.html">Lesson 5</a></p>
</body>
</html>

A Detailed Explanation:

An anchor containing an href attribute can be clicked on to navigate to a different page. If the target page is in the same folder as the page you are clicking on, then all you need to do is type the filename as the value for the href attribute.

<a href="somefile.html">Link to some file</a>

If the target page is in a folder within the folder containing the page you are clicking on, then include the subfolder and a slash before the file name.

<a href="may2003/newsletter.html">The May 2003 Newsletter</a>

If the target page resides in a folder one level up, then include ../ then the file name.

<a href="../about.html">About Us</a>

Previous Lesson | Next Lesson