Reputation: 59
I am trying to create a Navigation bar using Bootstrap 3. Looks like there are a lot of changes in the new version and lot of classes are missing.
Previously i had something like the following and am trying to convert the same into the new version of Bootstrap.
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a href="" class="brand">Project Name</a>
<ul class="nav">
<li class="active"><a href="">Link 1</a></li>
<li><a href="">Link 2</a></li>
<li><a href="">Link 3</a></li>
<li class="divider-vertical"></li>
<li><a href="">Link 4</a></li>
<li class="divider-vertical"></li>
</ul>
<form action="" class="navbar-search pull-right">
<input type="text" placeholder="Search" class="search-query" />
</form>
<p class="navbar-text">This is a text.</p>
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">Show Content</a>
<div class="collapse nav-collapse">
<p class="navbar-text">This will be hidden.</p>
</div>
</div>
</div>
</div>
I am sepecifically interested in the Search Form structure where i used to add the class search-query
class to the input class.
Also do we still need to add the navbar-inner
since the example in the official site doesnt use it.
Upvotes: 2
Views: 9937
Reputation: 17495
Check this link for a nice overview of the required changes for migration.
http://getbootstrap.com/getting-started/#migration
The navbar-inner
class for instance was dropped. This part of the new documentation should get you started: http://getbootstrap.com/components/#navbar
For the search-query
check this SO post: How to add a search box with icon to the navbar in Bootstrap 3? (well it has all your answers in fact).
Upvotes: 3
Reputation: 1394
I'm directly using the navbar like this :
http://getbootstrap.com/components/#navbar is quite clear
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <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="#"><span class="glyphicon glyphicon-cloud"></span> My Apps</a> </div>
<!-- https://github.com/twbs/bootstrap/issues/10495 added 2px padding top to center icon -->
<div class="collapse navbar-collapse navbar-ex1-collapse" style="padding-top: 2px;">
<ul class="nav navbar-nav">
<li><a href="Link_1.jsp">Link 1</a></li>
<li><a href="Link_2.jsp">Link 2</a></li>
<li><a href="Link_3.jsp">Link 3</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<div class="navbar-form navbar-left">
<div class="form-group">
<input id="searchInput" type="text" class="form-control" placeholder="Search">
</div>
<button id="searchButton" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</div>
</li>
</ul>
</div>
</nav>
Upvotes: 4