2

I know I can do this by putting a bookmark at the top but I thought there was another way to do that.

I tried just linking to #top and it worked, but just wondering if there are any problems with that.

  • 3
    What kinds of problems are you concerned about? – JCL1178 Dec 11 '14 at 19:25
  • You should be okay. There may be other ways, but that is old-school and should be fairly ordinary to search engines. – closetnoc Dec 11 '14 at 19:39
  • Linking to #top "works", even when an appropriate anchor does not exist, for the same reason #does-not-exist "works". You could also just use #. A bit of an aside, but... I wonder how many users actually use "back to top" links?! – MrWhite Dec 12 '14 at 12:22
  • I tried #invalid and it didn't work (I, too, thought it would work and it didn't, hence my question. This appears to be an undocumented feature so I wanted to confirm it works across the board) – Clay Nichols Dec 12 '14 at 14:07
2

There is no any standard that forbids or penalize links to top, so if you want to create and use such links, just do it.

Make sure to create the anchor though (with adding <a id="top"></a> entry somewhere near the element, you are linking to), otherwise it will just link to nowhere on the page, which most browsers trying to find at the top of page and scrolling viewport to the top.

| improve this answer | |
  • This isn't actually a "back to the top" link. The page is about a webapp and the signup is at the top of the page. So when we talk about the webapp I want to link from the name to the top of the page so they can get to the signin button). (Although I am considering linking to the signup page and bypassing the button) – Clay Nichols Dec 12 '14 at 17:11
  • 1
    You should use IDs for this rather than the name attribute. Plus you can attach it to an existing element e.g. <header id="top"> – DisgruntledGoat Dec 14 '14 at 2:04
  • @DisgruntledGoat - <a name="anchor"> is perfectly correct for anchors and supported since netscape era. IDs are nowadays more universal way, so may be preferred, agree. – Alex Grin Dec 14 '14 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.