gpt4 book ai didi

html - twitter bootstrap navbar 固定顶部重叠站点

转载 作者:行者123 更新时间:2023-12-01 22:54:22 24 4
gpt4 key购买 nike

我在我的网站上使用 Bootstrap ,并且导航栏固定顶部有问题。当我只使用常规导航栏时,一切都很好。但是,当我尝试将其切换到导航栏固定顶部时,网站上的所有其他内容都会向上移动,就像导航栏不存在并且导航栏与其重叠一样。这基本上是我的布局:

.navbar.navbar-fixed-top
.navbar-inner
.container
.container
.row
//yield content

我试图完全复制 Bootstrap 示例,但仅在使用导航栏固定顶部时仍然存在此问题。我究竟做错了什么?

最佳答案

您的答案在 docs 中是正确的:

Body padding required

The fixed navbar will overlay your other content, unless you add padding to the top of the <body>. Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.

body { padding-top: 70px; }

Make sure to include this after the core Bootstrap CSS.


Bootstrap 4 文档...

Fixed navbars use position: fixed, meaning they’re pulled from thenormal flow of the DOM and may require custom CSS (e.g., padding-topon the ) to prevent overlap with other elements.

关于html - twitter bootstrap navbar 固定顶部重叠站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11124777/

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