【问题标题】:Linking from one page to another section of another web page从一个页面链接到另一个网页的另一部分
【发布时间】:2014-05-14 23:54:54
【问题描述】:

我目前正在用 HTML 5 编写一个网站。我正在将页面链接到我网页的某些部分。出于某种原因,锚点一直将我带到页面的末尾而不是指定的点?

【问题讨论】:

  • 你做错了什么。显示一些代码并指定哪个锚点结束。

标签: html web tags anchor


【解决方案1】:
<div id = "main">
    One 
    <a href = "page2#main2">Go to main 2</a> 
</div>

另一个网页:page2

<div id = "main2">
    Two

</div>

【讨论】:

    【解决方案2】:

    这是你想成为的部分

    <div id="this-is-the-page">Hello World</div>
    

    只要把它放在你的锚标签中

    <a href="anotherpage.html#this-is-the-page">Link me there</a>
    

    【讨论】:

      猜你喜欢
      • 2012-08-14
      • 1970-01-01
      • 2010-11-18
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多