我如何链接到页面的一部分? (哈希?) [英] How do I link to part of a page? (hash?)
本文介绍了我如何链接到页面的一部分? (哈希?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何链接(使用< a>
),以便浏览器转到目标页面上的某个子标题而不是顶部?
How do you link (with <a>
) so that the browser goes to certain subheading on the target page as opposed to the top?
推荐答案
如果有<标记与 id
(例如,< div id =foo
>),然后您可以简单地追加 #foo
到URL。否则,您不能任意链接到页面的某些部分。
If there is an <a name="foo">
tag or any tag with an id
(e.g., <div id="foo"
>), then you can simply append #foo
to the URL. Otherwise, you can't arbitrarily link to portions of a page.
下面是一个完整的示例:< a href =http:// example.com/page.html#foo\">跳转到page.html上的#foo< / a>
Here's a complete example: <a href="http://example.com/page.html#foo">Jump to #foo on page.html</a>
相同的页面示例:< a href =#foo>跳转到同一页面上的#foo< / a>
这篇关于我如何链接到页面的一部分? (哈希?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文