简体   繁体   English

如何使我的列表与该部分同步(在同一页面上)

[英]How can I make my list to sync with the section (at the same page)

How can I make my <li> to sync with my <section> .如何让我的<li>与我的<section>同步。 I want to click to my navigation bar button/text and directly drive me to the currently section by scrolling down.我想单击导航栏按钮/文本并通过向下滚动直接将我带到当前部分。 (at the same page). (在同一页)。 How can I do that or can I do the same thing in another way?.我该怎么做,或者我可以用另一种方式做同样的事情? Btw I am new.顺便说一句,我是新人。

You can use an anchor link for this.您可以为此使用锚链接。 The link to an anchor is noted in the href-attribute by placing a # after the file where the anchor is located and then writing down the name of the anchor.通过在锚点所在的文件之后放置一个#,然后记下锚点的名称,可以在href-attribute 中注明指向锚点的链接。 A link to an anchor could look like this:指向锚点的链接可能如下所示:

<a href="#anchor">Click here</a>

The anchors for this could then look something like this:这个锚点可能看起来像这样:

<a name="anchor">Your text section</a>

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

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