gpt4 book ai didi

html - 粘性侧边栏在 Firefox 中没有正确的顶部空间

转载 作者:行者123 更新时间:2023-11-27 23:46:12 24 4
gpt4 key购买 nike

我在使用 firefox 显示整个侧边栏时遇到问题。正如您从图像中看到的那样,它接缝到顶部没有适当的空间,隐藏了第一个元素!

Image 1

这是 CSS:

/*
* Sidebar
*/

.sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 100; /* Behind the navbar */
padding: 0;
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar-sticky {
position: -webkit-sticky;
position: sticky;
top: 48px; /* Height of navbar */
height: calc(100vh - 48px);
padding-top: .5rem;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}

.sidebar .nav-link {
font-weight: 500;
color: #333;
}

.sidebar .nav-link .feather {
margin-right: 4px;
color: #999;
}

.sidebar .nav-link.active {
color: #007bff;
}

.sidebar .nav-link:hover .feather,
.sidebar .nav-link.active .feather {
color: inherit;
}

.sidebar-heading {
font-size: .75rem;
text-transform: uppercase;
}

这是 Bootstrap 模板之一的一部分!

预先感谢您的帮助!

最佳答案

因为它位于网格内并使用响应式类,所以当您使窗口变小或变大时,“间距”会发生变化。

<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">...</div>
</nav>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
...
</main>
</div>

关于html - 粘性侧边栏在 Firefox 中没有正确的顶部空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56798242/

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