Skip to Main Content
Creating a Website: The Missing Manual, 3rd Edition
book

Creating a Website: The Missing Manual, 3rd Edition

by Matthew MacDonald
May 2011
Beginner content levelBeginner
584 pages
17h 42m
English
O'Reilly Media, Inc.
Content preview from Creating a Website: The Missing Manual, 3rd Edition

Chapter 8. Linking Pages

So far in this book, you’ve worked on individual web pages. While creating a single page is a crucial first step in building a site, sooner or later you’ll want to wire several pages together so a web trekker can easily jump from one page to another. After all, linking is what the Web’s all about.

It’s astoundingly easy to create links—officially called hyperlinks—between pages. In fact, all it takes is a single new element: the anchor element. Once you master this bit of HTML lingo, you’re ready to start organizing your pages into separate folders and transforming your humble collection of standalone documents into a full-fledged site.

Understanding the Anchor

In HTML, you use the anchor element, <a>, to create a link. When a visitor clicks that link, the browser loads another page.

The anchor element is a straightforward container element. It looks like this:

<a>...</a>

You put the text a visitor clicks inside the anchor element:

<a>Click Me</a>

The problem with the above link is that it doesn’t point anywhere. To turn it into a fully functioning link, you need to supply the URL of the destination page using an href attribute (which stands for hypertext reference). For example, if you want a link to take a reader to a page named LinkedPage.htm, you create this link:

<a href="LinkedPage.htm">Click Me</a>

For this link to work, the LinkedPage.htm file has to reside in the same folder as the web page that contains the Click Me link. You’ll learn how to better organize ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Creating a Website: The Missing Manual, 4th Edition

Creating a Website: The Missing Manual, 4th Edition

Matthew MacDonald
Learn to Build a Website

Learn to Build a Website

Cassidy Williams, Camryn Williams

Publisher Resources

ISBN: 9781449306823Supplemental ContentErrata Page