Skip to main content

HTML Links - Create Bookmarks

HTML links can be used to create bookmarks, so readers can jump straight to a specific part of a page.


Create a Bookmark in HTML

Bookmarks are useful on a very long page. To make one, first create the bookmark with an id attribute on an element (for example <h2 id="C4">Chapter 4</h2>), then add a link to it using href="#C4". When the link is clicked, the page scrolls to the element with that id.

You can also link to a bookmark on another page by putting the file name before the #.

Example

A link that jumps to Chapter 4 further down the same page.

Prompt
A long page that uses a bookmark: a link at the top "Jump to Chapter 4" that points to #C4, and further down an h2 with id="C4" reading "Chapter 4", with enough filler content between them that clicking the link scrolls down to the chapter.
Output: complete HTML page

Bookmark on another page

Linking to a bookmark located on a different page.

index.html
<a href="html_demo.html#C4">Jump to Chapter 4</a>

Chapter Summary

To recap: use the id attribute (id="value") to define a bookmark on the page, and the href attribute (href="#value") to link to it.


HTML Link Tags

The main tag here is <a>, which defines a hyperlink.