Sometimes, we want to link to part of a page with HTML.
In this article, we’ll look at how to link to part of a page with HTML.
How to link to part of a page with HTML?
To link to part of a page with HTML, we use a hash and an ID.
For instance, we write
<div id="about"></div>
to add a div with ID about
.
Then we write
<a href="http://mysite.com/#about">About</a>
to add a link that goes to the div by putting #about
at the end of the URL.
Conclusion
To link to part of a page with HTML, we use a hash and an ID.