html 锚点:
I just found that <a href="#comment:9"></a>
can work the same as <a name="comment:9"></a>
,
which is more standard?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
I just found that <a href="#comment:9"></a>
can work the same as <a name="comment:9"></a>
,
which is more standard?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
一个并不比另一个更“标准”。它们都是 HTML 规范的一部分。第一个是第二个的链接。如果您单击,
那么您的浏览器将导航到由 定义的页面部分,
发生这种情况时您可能会看到滚动条在浏览器上移动。
One is not more "standard" than the other. They are both part of the HTML spec. The first one is a link to the second one. If you click on
then your browser will navigate to the part of the page defined by
You may see the scrollbar move on your browser when this happens.
似乎更明显,从而保留了
href
的本质,而不是name
对于表单元素来说更好/理想。The
<a href="#comment:9"></a>
seems to be more out there thereby preserving the essence ofhref
there rather thanname
which is better/ideal for the form elements.如果您尝试链接到网页内的目标,则应使用标准的#。这使得含义明确。仅仅因为一个浏览器对后一种方法做出了假设,并不意味着所有浏览器都会这样做,并且现在所做的浏览器将来也会继续这样做。
这里还有一个指向 HTML 中的链接文档的链接。
If you are attempting to link to a target inside of a web page, you should use # which is standard. This makes the meaning unambiguous. Just because one browser makes the assumption about the later method doesn't mean that all do and that the ones that do now will continue to in the future.
Also here is a link to the Links in HTML documentation.