简体   繁体   English

如何使导航栏与Bootstrap 3中的内容重叠

[英]how to make navbar overlaps content in bootstrap 3

I'm using the regular navbar of bootstrap not the fixed-top one, I figured out that when .navbar{position: fixed;} it overlaps, but that's not what I want. 我使用的是引导程序的常规导航栏,而不是固定顶部的导航栏,因此我发现当.navbar{position: fixed;}重叠时,但这不是我想要的。 I want when I scroll down the menu stays on the top of the page not to move with the page and overlap the content when the menu collapses. 我希望当我向下滚动时,菜单停留在页面顶部时不随页面移动,并且在菜单折叠时重叠内容。

this is my code so far: 到目前为止,这是我的代码:

<div class="navbar-wrapper">

<div id="menu" class="navbar navbar-right navbar-default nob no-focus" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse ">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <!-- <a class="navbar-brand" href="#">Project name</a> -->
    </div>
    <div class="navbar-collapse collapse ">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </div>
  </div>
</div>

this is what is happening now because is fixed-top 这是现在发生的事情,因为它是固定的

[ http://es.tinypic.com/view.php?pic=fc0i6s&s=8#.U9itaON5Py4] [ http://es.tinypic.com/view.php?pic=fc0i6s&s=8#.U9itaON5Py4]

thanks in advance. 提前致谢。

Try this, it will keep the navbar fixed rather than overlap once u start scrolling down. 尝试此操作,一旦您开始向下滚动,它将保持导航栏固定而不是重叠。

<div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">

                        <li class="active"><a href="#">Home</a></li>
                         <li><a href="#about">About</a></li>
                          <li><a href="#contact">Contact</a></li>



                </ul>


            </div>
        </div>
    </div>

Hope this helps :) 希望这可以帮助 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM