我已经知道如何通过在" a"中添加保证金来在SAME页面内锚定链接以获得固定的标题偏移问题。标签是:
about.html:
<a href="#goto"> Section 2</a>
.
.
. /*some other elements here to pass through*/
.
<a class="anchor" id="goto"> </a>
CSS:
.anchor {
margin-top: -300px; /* Size of fixed header */
padding-bottom: 300px;
display: block;
}
我也知道如何从一个页面转到另一个页面:
home.html的
<a href="www.mysite.com/about#goto">
现在,我尝试使用上面的代码从一个页面锚定到另一个页面,这是正确的,它转到另一个页面的锚定元素但是当它转到锚定元素时,固定标题问题仍然存在,意味着来自css锚元素的边距不起作用。
我在网上搜索,我看到的所有内容都是2个问题中的一个(固定页头偏移问题锚点和&amp;&amp;转到从一个页面到另一个页面的锚点),但不是两个同时出现。
我的问题:有没有办法解决从一个页面锚定到另一个页面的固定标题问题?
谢谢!