简体   繁体   English

锚链接HTML

[英]Anchor Link HTML

I'm trying to set up an anchor link for my site to jump to a particular heading on the same page. 我正在尝试为我的网站设置一个锚链接,以跳转到同一页面上的特定标题。 Below is my current code, but when you select the link nothing happens. 下面是我当前的代码,但是当您选择链接时,没有任何反应。 Any help would be great, thanks! 任何帮助将是巨大的,谢谢!

Section I want the link to jump to

<div class="heading1">
<h2 style="margin-bottom:-5px;font-size:40px;"><a id="#work"></a>content</h2>
<p style="font-size: 26px;">content</p>
</div>

Link

<div class="contact mobile">
<a href=“#work”>Work</a>
</div>

need to refer the href to the id of the div you want to jump to href="#jump" 需要将href引用到要跳转到href="#jump"的div的ID

 <div class="heading1" id="jump"> <h2 style="margin-bottom:-5px;font-size:40px;">content</h2> <p style="font-size: 26px;">content</p> </div> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <div class="contact mobile"> <a href="#jump">Work</a> </div> 

兄弟从属性id =“#work”中删除哈希,仅使用id =“ work”>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM