Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

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