书签链接标题不起作用

时间:2015-12-25 06:04:24

标签: html

我在网页顶部有一个目录,指向页面中的书签。这就是我所拥有的:

<a href="#sect1">Section 1</a>
<a href="#sect2">Section 2</a>
<a href="#sect3">Section 3</a>

...

<h2 id="sect1">Section 1</h2>
<p>This is my first section</p>

<h2 id="sect2">Section 2</h2>
<p>This is my second section</p>

<h2 id="sect3">Section 3</h2>
<p>This is my third section</p>

问题在于(当点击TOC项目时)页面焦点直接移动到该部分的文本,使得该部分的标题变为隐藏。然后,您必须向上滚动才能显示该部分的标题。换句话说,焦点似乎正在移动到书签之后。我希望它移到书签之前。

如何修复此标题以使标题保持可见?

0 个答案:

没有答案
相关问题