gpt4 book ai didi

html - Bootstrap anchor 偏移问题

转载 作者:太空宇宙 更新时间:2023-11-04 14:03:32 24 4
gpt4 key购买 nike

我在这里使用带有 Slate 主题的 Bootstrap:http://bootswatch.com/slate/

当跳转到同一页面上的不同 anchor 时,它会偏移并且不会转到它应该(或不正确显示)的确切内容部分。

例如:http://bootswatch.com/slate/#nav

这是为了跳转到“导航”部分,它几乎做到了,但它稍微向下偏移了,你看不到标题。

我在自己的网站上遇到了同样的问题,我该如何解决这个 anchor 问题?

我在做基础的:

<a href="#nav">Jump to Nav</a>

...

<a id="nav">Navs</a>

最佳答案

尝试包装一个 <a>在您要跳转到的元素周围,例如 this答案建议-例如

<a href="#nav">Jump to nav</a>

<a id="nav">
<h1 style="padding-top: 50px; margin-top: -50px;">Test</h1>
<!-- Offsets the fixed navbar -- just an example, this should be in CSS -->
</a>

关于html - Bootstrap anchor 偏移问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20226001/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com