Topic: HTML Basics

Link to a specific section of your web page – HTML

Summary

To create a link to a specific section of your web page, use an anchor element with the href attribute and use the ID of another element on the page as the value (prefixed with a hash sign):

<a href="#last-section">Link text</a>

<!-- Other HTML code might be here -->

<h2 id="last-section">Header</h2>

Demo

Link to specific section demo

Exercises

Using your text editor or CodePen, try creating a link to a specific section of your web page. (You will need to add a lot of text on the page in between the link and the element with the ID to see the effect work.)

References

The Anchor element on MDN