input group in navbar in Chrome
When you have an input-group (I've only tested it with a button) inside a navbar the form doesn't align and makes the navbar height way longer.
It works, except the width of the input goes crazy (hence the style="width: 200px;" hack): http://jsfiddle.net/9Z4MN/3/
Actually, the docs also cover the need to set an explicit width, so then this is just a matter of needing to use the correct markup; see jsFiddle for working example.
My apologies, the input width thing does seem like a legit bug.
Testcase: http://jsfiddle.net/Y9tqk/
If you uncomment the .input-group & .input-group-addon, then it's fine on mobile, but the input is crazy-wide on desktop screens.
If you leave it commented, then it works fine everywhere.
I can't style input width within a input-group; automatic size is fine for others surrounded controls but rarely useful for input one. The problem happens when you are text addon before and text addon after.
Also applies to plain .form-inline; see #10294.
This bug is preventing us from moving up from Bootstrap 2.3.2 on our project.
It had taken me hours to look for the right class to prevent the input field in navbar from being crazy wide before I got it's a bug. Will go with the style="width: 200px;" hack. Thanks.
Filing this as a Chrome bug: https://code.google.com/p/chromium/issues/detail?id=309483.
The gist is that an element with display: table; that's placed within a parent that has display: inline-block; occupies 100% of the available space when no pixel-width is set. Note that a % width doesn't work either. Once you add a pixel-based width to the .input-group, everything gets (no pun intended) back in line.
I believe I am also seeing the same bug in Safari 7.0 on OS X Mavericks.
Here's a minimal fix
Add class .navbar-input-group to the form
<form class="navbar-form navbar-left navbar-input-group" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search for awesome stuff">
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
Then add additional CSS (place in media query if necessary):
.navbar-input-group {
font-size: 0px; /*removes whitespace between button and input*/
}
.navbar-input-group .form-control {
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;
}
For purposes of clarity, I am targeting descendant elements in the CSS. This is not the most efficient way to target CSS elements. If you decide to use this, consider giving the input and button unique class names and targeting them without any descendant selectors in your CSS (read: http://csswizardry.com/2011/09/writing-efficient-css-selectors/)
célzott leszármazott elemek a CSS. Ez nem a leghatékonyabb módja annak, hogy cél -hogy ezt fontolóra a bemeneti és a gombok egyedi osztály nevét,
Safari 7.0 (9537.71) - same problem Chrome 31.0.1650.57 - same problem Firefox 25 and 25.0.1 - there it's OK
Also applies to IE 11
An simple fix for this is targeting .input-group-btn and input-group-addon within .navbar-form with a auto width. See below:
.navbar-form .input-group-btn, .navbar-form .input-group-addon { width: auto; }
@ntkk72 Your fix is perfect! @mdo Any chance this will be included in Bootstrap? Does a new issue need to be opened to reference this solution?
Thanks @ntkk72 your fix has saved my sanity!
The same, thanks @ntkk72, your fix resolved my problem!
If there is still a bug in the latest master, yes, please open a new issue. Include a link to this one and a new test case (preferably a JS Bin).
thanks @ntkk72,
To make sure inputs are taking 100% width when collapsed, I put ntkk72 css correction within @media (min-width:768px;){}