Reputation: 4518
I have a form in a navbar on the top of my page.
Here is the HTML
<nav id ="topNav" class="navbar navbar-default">
<form class="navbar-form navbar-right navbar-input-group" role="search">
<div class="form-group">
<input type="password" class="form-control" placeholder="Password">
</div>
<button type="submit" class="btn btn-default">Login</button>
</form>
</nav>
And here is the CSS for the form
.navbar-input-group {
font-size: 0px;
margin-right: 20px;
}
.navbar-input-group input {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
.navbar-input-group .btn {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
border-left: 0px;
}
This is what it looks like on the browser
I'd like to add some text (a heading h3) to the left of the form without this happening
I just added a h3 element above the form...
<nav id ="topNav" class="navbar navbar-default">
<h3>Text</h3>
<form class="navbar-form navbar-right navbar-input-group" role="search">
Upvotes: 0
Views: 93
Reputation: 94
Or use
<ul class="nav navbar-nav">
<li><h3>text</h3></li>
</ul>
before the form tag, if you want to add more items to your navbar. Check the examples on the http://getbootstrap.com/getting-started/#examples
Upvotes: 1
Reputation: 9739
Try this
.navbar h3, .navbar form{
display: inline-block;
}
Upvotes: 5