Links between pages
A hyperlink is what turns separate pages into a site. It is written with the a tag: <a href="page2.html">Go to page two</a>. The href attribute says what the link opens: a file name in the same folder, a path such as pic/router.webp, a program, or a full web address. The text between the opening and the closing tag is what the visitor clicks; it may also be a picture. A link to a file works only if the file exists with exactly that name, so check the spelling. For a visitor to move around freely, links must work in both directions: page one links to page two, and page two links back to page one. Later in this term the header page will give every page the same menu. In our lessons every link points to a page that the lesson names; we do not invent real web addresses.
1<p>Next: <a href="page2.html">Go to page two</a></p>The page shows the line Next: followed by the clickable words Go to page two. A click opens the file page2.html.
| Page | Link text | href | Opens |
|---|---|---|---|
| page1.html | Go to page two | page2.html | page2.html |
| page2.html | Back to page one | page1.html | page1.html |
1<a href="help.php"><img src="images/help.webp" alt="Help page"></a>The page shows the small help picture. A click on the picture opens help.php.
On paper design three pages for a small reading-club site (home, books, contact). Write the one line of HTML for each link needed so that every page links to the other two. Check that each link names a file you listed.