To create a link that goes to the top of a web page, follow the steps below.
In your HTML code, between the opening and closing
tags, add a new line where you want to place the link.Add the top of page link using #top as the value of the href attribute, as shown below.
For example, clicking this link takes you back to the top of the page.
Create a “Back to top of page” button
If you want to create a button that goes back to the top of a web page, use the following example code.
All modern browsers understand the “#top” value, meaning the id or anchor is not needed to return to the top. However, all other anchors need to be defined in the page.
- How to create an HTML push-button link.
Related information
- See the anchor definition for further information and related links.
- HTML and web design help and support.