如何在html中的同一页面上创建指向各部分的链接(但不同的选项卡)

发布于 2025-02-07 07:44:46 字数 358 浏览 1 评论 0原文

正如问题所述,我想在我的页面中制作超文本,其中包含4个选项卡(编织为HTML)。 我知道这种方法在没有不同选项卡的同一页面中很好地工作,但它与我不合适。

使用#id选择器 < p id =“打开”>超链接使用Web浏览器从一个页面移动到另一页...</p>

创建指向选择器的链接 < a href =“#打开”>带我去开头段落。</a>

您能帮我吗?

例如,在“家庭”选项卡中,我想要一个超文本,将用户引导到“关于我们”选项卡中的特定部分,

谢谢

,我正在使用html和r markdown使用html来编织文件。

As the question says I want to make hypertext in my page which contains 4 tabs (R Markdown file knitted as HTML).
I know this method works well within the same page that doesn't have different tabs but it didn't work with me.

Using the #id selector
<p id="opening">Hyperlinks are utilized by a web browser to move from one page to another...</p>

Creating a link to the selector
<a href="#opening">Take me to the opening paragraph.</a>

Can you please help me with that?

For example in the "home" tab I want a hypertext that directs the user to a specific section in "about us" tab

Thanks in advance

Btw, I am using HTML with R Markdown to knit the file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

习ぎ惯性依靠 2025-02-14 07:44:48

这是您可以做的。您可以为容器分配一个宽度和高度,然后溢出:自动。每个儿童必须具有与container相同的高度和相同的宽度,因此,如果您有几个孩子,这将溢出。

超链接选项卡在单击时会做什么,它滚动以查看上述儿童

.container {
  width: 200px;
  height: 200px;
  overflow: auto;
}

.child {
  display: block;
  background: aliceblue;
  height: 200px;
}
<div class="container">
<div class="tabs">
<a href="#Tab-1">Tab-1</a>
<a href="#Tab-2">Tab-2</a>
<a href="#Tab-3">Tab-3</a>
</div>
<div id="Tab-1" class="child">
Tab 1
</div>
<div id="Tab-2" class="child">
Tab 2
</div>
<div id="Tab-3" class="child">
Tab 3
</div>
</div>

This is something that you can do. You can assign a width and height for your container, then overflow: auto. Each children has to have the same height and same width as the container, therefore, if you have several children, this will overflow.

What the hyperlink or tab does when you click, it scroll to view on the said children.

.container {
  width: 200px;
  height: 200px;
  overflow: auto;
}

.child {
  display: block;
  background: aliceblue;
  height: 200px;
}
<div class="container">
<div class="tabs">
<a href="#Tab-1">Tab-1</a>
<a href="#Tab-2">Tab-2</a>
<a href="#Tab-3">Tab-3</a>
</div>
<div id="Tab-1" class="child">
Tab 1
</div>
<div id="Tab-2" class="child">
Tab 2
</div>
<div id="Tab-3" class="child">
Tab 3
</div>
</div>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文