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

Adding Bookmarks

Most links lead from one page to another. When you make the jump to a new page, the browser plunks you down at the very top of the page. But you can also create links to specific parts of a page. This is particularly useful if you create long, scrolling pages and you want to direct your visitors’ attention to a particular passage.

You can create links to another position on the current page (see Figure 8-7), or to a specific place in another web page. The place you send your reader is technically called a fragment.

This FAQ (frequently asked questions) page is an example of bookmarks at work. Here, the entire FAQ is a single long page, with a series of bookmark links at the top that let you jump to just the topic you’re interested in. You could break an FAQ into separate pages, but readers wouldn’t be able to scan through the whole list of questions, and they wouldn’t have a way to print the entire document at once.

Figure 8-7. This FAQ (frequently asked questions) page is an example of bookmarks at work. Here, the entire FAQ is a single long page, with a series of bookmark links at the top that let you jump to just the topic you’re interested in. You could break an FAQ into separate pages, but readers wouldn’t be able to scan through the whole list of questions, and they wouldn’t have a way to print the entire document at once.

Creating a link that points to a fragment is a two-step process. First, you need to identify the fragment. You do this with the id attribute, which assigns a unique name to any HTML element on a page.

For example, imagine you want to send a visitor to the third level-3 heading in a web page named sales.htm. Initially, the markup looks like this:

... <h3>Pet Canaries</h3> <p>Pet canary sales have plummeted in the developed world, due in large part ...
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