How to put a ‘back to top’ link at the bottom of a page

Long webpages often have a link to take the user back to the top of the page. 2 things are needed for this. Immediately inside the body tag of your HTML document put:

<a name=”top”></a>

This is an anchor, with a specified name. To link to it you use a link the name, prefixed with # to show that the link is to the same page (this tells the browser it doesn’t need to reload the page)

<a href=”#top”>Back to top</a>

You can also use this to make a table of contents by putting anchors at the start of each section of the page.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Leave a Comment