HTML Links Within the Same Page

To link to another location on the same page, give the destination an id and link to that fragment with href="#id". Modern HTML does not require an empty <a name="..."> anchor.

<a href="#faq">Jump to FAQs</a>
...
<h2 id="faq">Frequently Asked Questions</h2>

Same-page navigation example Top ↑

Go to the middle example ยท Go to the end example

Middle example Top ↑

This heading is the destination of #middle-demo.

End example Top ↑

This heading is the destination of #end-demo.

Link to a fragment on another page Top ↑

<a href="guide.html#examples">Examples in the guide</a>

Fixed-header spacing Top ↑

If a sticky header covers anchored headings, CSS scroll-margin-top can reserve space when the browser scrolls to the target.

h2 { scroll-margin-top: 5rem; }

Accessibility Top ↑

Use unique IDs, meaningful link text and headings that describe the destination. Fragment links are useful for tables of contents, FAQs and long reference pages.

HTML hyperlinks New-tab links





plus2net.com







vijay

03-08-2013

Thank You for this article. Your site is nice and easy to understand for learners like me...! thank you.



✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer