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.
<a href="#top" title="Go to top of page">Go to top of page</a>
这将生成 http://www.mysite.com/#top 这对您的访问者来说更有意义。
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.
发布评论
评论(3)
是的,您可以而且应该使用它,因为这就是它的意思。没有其他做法可以实现“返回顶部”按钮,即使有,与此相比也不必要地复杂。
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.
我认为只使用“#”不好。对于用户来说意义不大。
您无需定义额外的 id,只需使用它即可返回页面顶部。使用页面上现有的元素要好得多。例如,如果页面顶部有徽标,则可以为
标记分配 'top' id:
然后在页面底部,您可以使用此元素id 转到页面顶部:
这将生成
http://www.mysite.com/#top
这对您的访问者来说更有意义。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':At the bottom of the page, you can then use this element id to go to the top of the page:
This will produce
http://www.mysite.com/#top
which will be more meaningful for your visitors.href="#"
的缺点是在 URL 中添加#
。最好“返回顶部”按钮的做法是使用两个选项重新加载页面:
空 href:
页面顶部
将页面重新加载到当前文件中,写入文件名,例如:
页面顶部
.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>
.