Can we use just <a href="#"> for "back to top" button at bottom of the page?

Jitendra Vyas picture Jitendra Vyas · Feb 4, 2010 · Viewed 27.5k times · Source

Can we use just <a href="#"> for "back to top" button at bottom of the page? I think it will work always in all browser. We do need to define any ID .

When we click on this <a href="#"> it takes to page top always. or what are other best practices to use "back to top" button.

Answer

Tatu Ulmanen picture Tatu Ulmanen · Feb 4, 2010

Yes, you can and should use that, as that is what it means. There are no other practices for doing a 'back to top' button, and even if there is, they're unnecessarily complicated compared to this.