Take the 2-minute tour ×

I have looked around many places return to top button .when i click on that that takes me to top of the page.

some time some links taking me to particular place how does this works

is this html tack ticks or javascript..can i do this without page loading ?

share|improve this question

4 Answers 4

up vote 5 down vote accepted
<a name="top">Top of the page</a> 
<a href="#top">return to top</a>

Note: HTML5 recommends using id="top" rather than name="top"

share|improve this answer
can i do this with out loading ? –  gowri Apr 12 '11 at 13:35
yeah with javascript, see the other post –  oblig Apr 12 '11 at 13:39
this solution doesn't reload the page because the supplied href starts with a hash symbol (#). It causes the browser to scroll to the anchor if the specified name. –  shanethehat Apr 12 '11 at 13:57

The #top bit refers to the id of an element that resides at the top of your page. In most cases this will be something like #header where you have:

<div id="header"></div>

at the top of the page. I'd suggest not using name as I believe the attribute is now deprecated.

Of course, to make it a little more fancy you could use something like: http://webdesignerwall.com/tutorials/animated-scroll-to-top

share|improve this answer

If you require to jump to a particular portion of the page by default during page than read on: Just append the id of the tag with URL. Eg: <div id='myID'>Some content</div>

Now if your URL ends with #myID than it shall jump to that portion automatically.

share|improve this answer

Lastly you can use javascript too:

<a href="#" onclick="document.getElementById('someId').scrollIntoView(); return false</a>

but assuming all modern browsers can do some id it is less needed nowadays

share|improve this answer

Your Answer


