同一网页上的2个“反之亦然”链接

最简单的方法是...


...让LINK1指向LINK2





... LINK2指的是LINK1吗?




最基本的方法可能是通过具有唯一spanid

<a href=#LINK2><span id="LINK1>This is LINK1 referring to LINK2</span><a/>

<a href=#LINK1><span id="LINK2>This is LINK2, which refers back to LINK1.</span></a>

但是,也许有更快,更省力,更优雅的解决方案(请参阅正在构建的文档,动态文件或大型文件)吗?

最佳答案

你可以用



<a href="#link2" id="link1">This is LINK1 referring to LINK2.<a/>
<a href="#link1" id="link2">This is LINK2, which refers back to LINK1.</a>




.space {
  height: 100000px;
  display: block;
}

<a href="#link2" id="link1">This is LINK1 referring to LINK2.<a/>
<span class="space"></span>
<a href="#link1" id="link2">This is LINK2, which refers back to LINK1.</a>

关于html - 链接回原始链接源(两个链接都在同一页面上),反之亦然,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28527990/

10-12 07:00