When placed in menu, the search form pushes down the nav bar
Forgive me if this isn't the correct use of Twitter Bootstrap, but I wanted to add the search form to the nav. Here's my code:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">mywebsite.net</a>
<div class="btn-group pull-right">
<form class="form-search">
<input type="text" class="input-medium search-query">
<button type="submit" class="btn">Search</button>
</form>
</div>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">My Link</a></li>
<li><a href="#">My Link 2</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
Anyways, this code pushes the nav bar down. The CSS responsible is here:
form {
margin: 0 0 18px;
}
Firstly, am I using the search form correctly? Secondly. how does one modify the form CSS to something like:
form {
margin: 0 0 0px;
}
Thirdly, how is Bootstrap designed to be customised? Should I being forking the entire repo or adding my own CSS? Not quite sure what the best practice is.
for your margin, I would look at adding it as :0 0 0 18px for margin-bottom,
or if you want it to applied to the left make it 0 0 18px 0; Also, did you apply padding to the page.
The bar will be pushed down a little and you need to add margins/padding to the bar to get it to sit.
Also, I would not use span classes. Use ul tags with li childrens.
as so: ul class="nav" li class="active"
for a drop down, add another li class="dropdown" with another set nested ul>'s: ul class="dropdown-menu"
and for the serach, after the last UL is closed, add your form class="navbar-search pull-left(or)pull-right" action="your action here" within the same container div.
The span classes come for Twitter Bootstrap code. I guess I have to figure out LESS to customise this and add my own rules.
Per the navbar docs, you need .navbar-search on the form, not .search-form.
Thanks, that looks way better!