Skip to content

Try our new Crash Courses!

Become a member using the button below to hide this banner and gain access to our new Crash Courses.

Link to the top of your web page – HTML

Length: 10 minutes|

Demo

Summary

<a href="#top">Link to top</a>

<a href="#">Link to top</a>

Details

You can create a link to the top of your web page by using #top or # for the href value. You don’t have to have an element with the id top for this to work.

<!-- Other code goes here... -->
<a href="#top">Link to top</a>

<a href="#">Link to top</a>

Exercises

Try recreating the HTML code from the Demo section. Then try customizing the text inside the link.

References

The Anchor element on MDN

Back to: HTML Reference > HTML Links