Bhylu

Link Bookmarks

A fragment link moves to an identified part of a document. It is useful for a table of contents, a help page, or a direct link to a specific section.

How it works

  • Give the destination a unique id and refer to it with # followed by that id. The text is case-sensitive in ordinary HTML fragment matching.
  • The same idea works across documents: guide.html#tools points to a section inside another page.
  • If a fixed header covers the destination, use CSS scroll-margin-top on section headings rather than adding arbitrary blank content.

A practical example

HTML

<a href="#packing-list">Jump to the packing list</a>
<h2 id="packing-list">Packing list</h2>
<ul>
  <li>Notebook</li>
  <li>Reusable bottle</li>
</ul>

The link points to the heading’s id. In an ordinary page, following it updates the URL fragment and brings that section into view.