固定顶栏下的div [英] Div under fixed top bar
问题描述
我想要一个固定的顶部栏,内容如下.但是,如果我不设置 margin top,这个 div 的内容将被放置在固定的顶部栏下方.
</nav><div class="容器"><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1>
设置 margin top 是正确的方法,或者 boostrapt 有什么方法可以做到这一点?
查看 文档一>.
<块引用>固定导航栏将覆盖您的其他内容,除非您添加填充到 .尝试您自己的价值观或使用我们的下面的片段.提示:默认情况下,导航栏的高度为 50 像素.
body {填充顶部:70px;}
I want a fixed top bar, with content below. However, if I don't set the margin top the content of this div will be placed under the fixed top bar.
<nav class="navbar navbar-default navbar-fixed-top">
<div id="navbar" class="navbar-collapse collapse"></div>
</div>
</nav>
<div class="container">
<h1>Navbar example</h1>
<h1>Navbar example</h1>
<h1>Navbar example</h1>
<h1>Navbar example</h1>
<h1>Navbar example</h1>
</div>
Set a margin top is the correct way, or there is some way in boostrapt to make this?
See the Docs.
The fixed navbar will overlay your other content, unless you add padding to the top of the . Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.
body {
padding-top:70px;
}
这篇关于固定顶栏下的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!