How can I get Twitter Bootstraps mobile navbar to overlay the content on the page instead of pushing it down?
If you add a class like navbar-absolute
to your navbar:
<div class="navbar navbar-fixed-top navbar-absolute">...</div>
, and a couple of CSS rules:
@media (max-width: 979px) {
.navbar-fixed-top.navbar-absolute {
position: absolute;
margin: 0;
}
}
.navbar-absolute + div {
margin-top: 68px;
}
It should get you started.
JSFiddle
Overlay navbar, rather than push page contents, on expand
Add fixed-top
class to your navbar.
When using a fixed-top
navbar, your <body>
element needs a padding-top
property equal to the height of the navbar (normally 70px
- but can differ based on the theme).
The above is also true for fixed-bottom
navbars (at the bottom end).
Bootstrap collapsed menu not pushing content down when expanded
I don't know. This seems to work... (kind of a hack though).
.navbar-fixed-top {
top: -70px; /* you'll have to figure out the exact number here */
}
.navbar-fixed-top, .navbar-fixed-bottom {
position: relative; /* this can also be static */
}
Twitter Bootstrap nav Collapse drop-down menu is overlapping content?
For Centering logo, implement this css code to the referred class...
.container { position:relative; }
.brand { text-align: center; width: 97%;}
.navbar .btn-navbar {
display: block;
position: absolute;
right: 0;
}
For Centering, the nav links,
.nav-collapse .nav > li > a {
margin: 12px 0 !important;
text-align: center;
}
And for the drop-down overlay issue, add this,
.nav-collapse { padding-top: 1em; }
Make Bootstrap static-navbar overlay content like fixed-navbar
@Aibrean helped out. I used the navbar-fixed-top class and added "position: absolute" on the navbar class.
top nav bar blocking top content of the page
Add to your CSS:
body {
padding-top: 65px;
}
From the Bootstrap docs:
The fixed navbar will overlay your other content, unless you add padding to the top of the body.
Bootstrap dropdown overlapping container div, rather than pushing it down
I'm thinking that the easiest solution for this will be that you need to clear your floats in the primary and secondary menu.
As you can see you have:
<div class="navbar navbar-static-top">...</div>
And you also have:
<div class="secondmenu">...</div>
The easiest way to clear these would be to put them inside a .row
class or .row-fluid
. I also suggest that you get into the habit of adding rows to your code when you can so these kinds of things clear.
Your code should end up looking like this:
<div class="row">
<div class="navbar navbar-static-top">...</div>
<div class="secondmenu">...</div>
</div>
Last but not least... your text is not positioned absolutely in relation to the slider div, but instead to the browser chrome, so you need to make your slider container have a position: relative
so any elements set to position: absolute
inside that container (in this case your h1
) will be positioned absolutely according to it's parent container.
So set this in your styles as well:
.sliderwrap {
position: relative;
}
That pretty much fixes your double menu so it clears the slider and the text. Let me know if this works for you and if you need any clarification on the answers, don't forget to upvote or accept the answer if it works! Cheers.
Related Topics
Google Chrome: Diagonal CSS Line-Through
How to Alternate The Number of Children Between Odd and Even Rows
Unwanted CSS Injected into Posts
Editing Angular Material's Table Cell Padding
Firefox Displaying Table-Cell Incorrectly (Chrome Working Good)
Creating Small Navbar and a Side Panel in Materialize CSS
<Style> and <Script> Tags Are Displayed Physically on Page
Are There Appearance CSS Rules for Webkit-Overflow-Scrolling: Touch "Handle" in iOS 5
How to Align Label and Select Box Vertically (Middle)
Remove White Space Under Footer
How to Reverse-Engineer a Webkit Matrix3D Transform
Horizontal Submenu for a Vertical Main Menu Using Bootstrap
How to Prevent a Flex Item Height to Overflow Due to It's Content
How to Draw Lines Through Bootstrap Vertical Dividers