Free tools Windows power users keep installed
One-click scans. No signup required.
To create a bookmark within an HTML document, give the destination element a unique, non-empty id, then link to it with href="#that-id". Put the ID on the heading, paragraph, or table cell that represents the destination; an empty anchor or div is usually unnecessary.
How to create an in-page bookmark
In modern HTML, a “bookmark” is an element identified as the destination of a URL fragment. The WHATWG HTML Standard describes an element’s unique identifier as a way to link to a specific part of a document using fragments.
As an Amazon Associate I earn from qualifying purchases.
-
Add a unique, non-empty
idto the element you want readers to reach.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Link to that ID by putting a hash (
#) and the same value in the link’shref.#1 Best Overall
SaleHTML and CSS: Design and Build Websites- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
<p>Here we are talking about <a href="#carrot">carrot cake crackers</a>.</p>
<h2 id="carrot">Carrot Cake Cracker</h2>
<p>These are the ingredients you need.</p>
Clicking the link navigates to the element whose ID is carrot. For a link from another page, append the same fragment to that page’s URL, such as https://example.test/recipe#carrot.
Where to put the ID
Attach the ID to the existing element that best represents the destination. For a section, that is commonly its heading; for a specific passage, it may be a paragraph. If the intended destination is in a table, put the ID on the relevant cell or other element that identifies the destination.
Rank #2
<table>
<tr>
<td id="ingredients">Flour, sugar, and carrots</td>
</tr>
</table>
<a href="#ingredients">See the ingredients</a>
Why an ID on existing content is usually better than an empty anchor
The May 2014 SitePoint discussion asked whether to use an empty div, an empty a, or an ID on existing content. Its practical recommendation is to put the ID on the paragraph, heading, or table cell that is actually the destination. That avoids adding a separate, empty element when meaningful content already marks the location.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Use an empty element only when there is no suitable existing element to identify as the target. The key is that the fragment must match an ID on the destination element.
Rank #3
Rules for IDs and older bookmark markup
-
An ID must not be empty and must be unique within its element tree, as specified by the WHATWG HTML Standard.
-
Use one ID for each destination. If two elements share an ID, the target is no longer uniquely identified.
Rank #4
SaleWeb Design with HTML, CSS, JavaScript and jQuery Set- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
-
Use
idfor contemporary HTML fragment targets. The SitePoint thread’s references to the oldernameattribute describe historical guidance, not the current recommendation.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
For links in the same document, the fragment is simply #id-value. For links from another document, use that page’s URL followed by #id-value.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




