Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap 3 increasing navbar-header div width

Here's my code:

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header" >
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Company</a>
      
        <form class="navbar-form navbar-left" role="search">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="Search">
            </div>
        </form>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#/Activity">Activity</a></li>
        <li class="active"><a href="#/Customers">Customers</a></li>
        <li><a href="#/Inventory">Inventory</a></li>
        <li><a href="#/Orders">Orders</a></li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->

Basically, I've been searching through Twitter Bootstrap 3 and Stack-Overflow for the past 2-3 hours.

I would like to increase the width of the div class navbar-header so that I can have a search input that spans the top middle of the nav bar.

Seems like when the navbar collapses it extends the search Too far.

Example in Fiddle

Basically I want the same thing as Gmail with the Google Logo, Big Search box, icons/links on the right.

like image 834
educatdrisk Avatar asked May 07 '14 16:05

educatdrisk


People also ask

What is navbar in Twitter Bootstrap?

Twitter Bootstrap provides Navbar component which is responsive in nature and can be used to serve as navigation menu for your web application or site. These navbars are collapsed and toggleable in mobile devices and stretch out horizontally for wider viewport.

Is the navbar always collapsed in Bootstrap 4?

The Navbar is always collapsed into the vertical view, and toggled via the hamburger. The Navbar collapses into vertical view at one of the 4 responsive breakpoints. As you can see from the code above the navbar-header class has been removed from Bootstrap 4, and the container-fluid is no longer required for a full width Navbar.

How to center a Div in Twitter Bootstrap?

Using Twitter Bootstrap's center-block helper class, which is available in Bootstrap 3.2, you may center a div. center-block class contains following css code.center-block { display: block; margin-right: auto; margin-left: auto; }

Is container-fluid required for a full width navbar in Bootstrap 4?

As you can see from the code above the navbar-header class has been removed from Bootstrap 4, and the container-fluid is no longer required for a full width Navbar.


1 Answers

Use display:inline on the form-group..

Here's a working demo: http://www.bootply.com/Vi3dsd5qLk

like image 153
Zim Avatar answered Oct 27 '22 19:10

Zim