固定顶栏下的div [英] Div under fixed top bar

查看:29
本文介绍了固定顶栏下的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个固定的顶部栏,内容如下.但是,如果我不设置 margin top,这个 div 的内容将被放置在固定的顶部栏下方.

</nav><div class="容器"><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1><h1>导航栏示例</h1>

设置 margin top 是正确的方法,或者 boostrapt 有什么方法可以做到这一点?

http://jsfiddle.net/5f5g3mu0/

解决方案

查看 文档.

<块引用>

固定导航栏将覆盖您的其他内容,除非您添加填充到 .尝试您自己的价值观或使用我们的下面的片段.提示:默认情况下,导航栏的高度为 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?

http://jsfiddle.net/5f5g3mu0/

解决方案

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屋!

查看全文
相关文章
前端开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆