How to link to part of a page with HTML?

Spread the love

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.

Leave a Reply

Your email address will not be published.