Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to use Bootstrap 3 Navbar without responsive collapse

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?

like image 322
Ender2050 Avatar asked Aug 17 '13 19:08

Ender2050


People also ask

How do I make bootstrap navbar not collapse?

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.

Is bootstrap navbar responsive?

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 .

Which Bootstrap CSS class will you use to put the navbar at the top of the page?

Use the . navbar-text class to vertical align any elements inside the navbar that are not links (ensures proper padding and text color).


1 Answers

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

like image 93
Zim Avatar answered Sep 21 '22 09:09

Zim