<a href="#top">Go to top</a>
To create a link that goes to the top of a web page, follow the steps below.
In your HTML code, find the opening <body> tag (this should be located right after the closing </head> tag). Immediately after the opening <body> tag, add the following code:
<a name="top"></a>
The above code would create an anchor on the page named top.
Next, place the link back to the top of the page by using the # symbol followed by the anchor name/id (in this case top) as the value of the href attribute, as shown below:
<a href="#top">Back to top of page</a>