I'm trying to create a simple Navbar in Bootstrap 3 that doesn't collapse - responsive isn't necessary here because we just have a simple title on the left + button on the right.
My goal is to have the title + buttons always appear the same for all resolutions. Something like this:
<div class="navbar navbar-fixed-top"> <form class="navbar-form navbar-right"> <button class="btn btn-default">Button 1</button> <button class="btn btn-default">Button 2</button> </form> <a class="navbar-brand" href="#">Title Here</a> </div>
I've tried numerous combinations from the documentation. And this post outlines how to use the new .nav-header classes. I've tried duplicating the elements inside .nav-header - and also tried overriding the BS3 media query styles.
Is there an easier way to use the Navbar without collapsing?
For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don't add any .navbar-expand class.
Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin. Navbars are hidden by default when printing. Force them to be printed by adding .
Use the . navbar-text class to vertical align any elements inside the navbar that are not links (ensures proper padding and text color).
The best way I could find is to use 2 navbar-header
containers, and then use pull-left
and pull-right
since they aren't tied to any responsive media queries..
<div class="navbar navbar-fixed-top"> <div class="navbar-header pull-left"> <a class="navbar-brand" href="#">Title Here</a> </div> <div class="navbar-header pull-right"> <button type="button" class="btn btn-default navbar-btn">Button 1</button> <button type="button" class="btn btn-default navbar-btn">Button 2</button> </div> </div>
Demo on Bootply: http://bootply.com/74912
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