Back to Top – Link to Top of the Page

by Admin 4. March 2014 19:35

Hi Guys,

Here is a quick tip for you guys. I still remember the first time I needed a link that user can click to get to the top of the page. I used to add an anchor tag  like this <a href="#" name="top"></a> to the top of the page and then somewhere down the page link to it as: 

<a href="#top">Back to Top</a>

The problem with this method was that you had to add an extra element (anchor tag) to the top of the page. Recently, I achieved the same goal slightly differently. I added an id to the body of the page. e.g.

<body id="top">

Then down the page I created a link:

<a href="#top">Back to Top</a>

Thats it! You don't need to add that anchor on top, simply use the existing body element and give it an ID.

Tags: , ,

Web Design Tips

Comments are closed
© 2014 FMR Web Design Delray Beach, Florida | P: (561) 235-3775 | E: