I'm using Bootstrap and need to have 2 fixed nav bars, top and bottom. The content between them gets long and needs to have a scrollbar. The thing is that the scrollbar appears on the entire screen while I want it to be on the content only:
<div>
<div class="navbar navbar-blend navbar-fixed-top">
<div class="row">
<div class="col-xs-9 col-md-9"><span>Text top</span></div>
</div>
</div>
<div id="content">
<div class="container">
<div>
<div class="row">
<div class="col-xs-12 col-md-12"><p>Row1</p></div>
</div>
<div class="row">
<div class="col-xs-12 col-md-12"><p>Row2</p></div>
</div>
</div>
</div>
</div>
<div class="navbar navbar-blend navbar-fixed-bottom">
<div class="nav"><span>Text buttom</span></div>
</div>
</div>
See it here: JSFiddle
I've been following some answers to similar questions (here and here, for instance), but none of them has worked. I'm probably missing something.
In my JSFiddle you see my original version, since none of the suggested fixes worked for me.
Can you assist?
Use position absolute and set the top value to the number of pixels you want the Nav bar to be from the top of the browser.
Use position: fixed instead of position: absolute .
Hello there, To make the nav bar and top bar scroll normally, you may go to Appearance > Customize > Header > Navbar Position > Select: Static Top.
The content of your page needs to be in a separate div
that does not take up any portion of the screen that overlaps with your top and bottom nav bars. In your case, you need to add position: fixed
to your content, then make sure it doesn't occupy the top and bottom areas.
Adding the following CSS should work:
#content {
position: fixed;
top: 80px;
bottom: 80px;
left: 0;
right: 0;
}
jsFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With