2010-02-04 13 views

Odpowiedz

13

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.

+0

i'm not sure if it work same in all browsers –

+0
+1

Go to top of page w znacznie lepszy sposób. –

1

I don't think using just '#' is good. It's not very meaningful for the user.

You don't need to define an extra id just to use it to snap back to the top of the page. It's much better to use an existing element on the page. For example, if you have a logo on top of the page, you can assign the <img> tag the id of 'top':

<img src="logo.png" id="top"> 

At the bottom of the page, you can then use this element id to go to the top of the page:

<a href="#top" title="Go to top of page">Go to top of page</a> 

This will produce http://www.mysite.com/#top which will be more meaningful for your visitors.

-1

The disadvantage of href="#" is the addition of # to the URL.
The best practice for “back to top” button is to reload the page using two options:

Empty href:
<a href="">Top of the Page</a>

Reload the page to the current file in terms of writing its name, for example:
<a href="filename.html">Top of the Page</a> .

Powiązane problemy