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.
Basically I want the same thing as Gmail with the Google Logo, Big Search box, icons/links on the right.
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.
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.
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; }
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.
Use display:inline
on the form-group
..
Here's a working demo: http://www.bootply.com/Vi3dsd5qLk
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