Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input groups bigger than input in Bootstrap 3 using Jumbotron container

I'm experimenting a strange behavior with Bootstrap 3 input groups. When I add an input-group-addon (text or icon) to a form inside a jumbotron, the input-group height is bigger than its input height.

Here you can find a JsFiddle and an screenshot with the problem:

<div class="jumbotron">     <h1>Jumbotron with form</h1>         <form>            <div class="input-group">                <input type="text" class="form-control" placeholder="Username">                   <span class="input-group-addon">@</span>            </div>          </form>   </div> 

Live example at http://jsfiddle.net/DTcHh/

Screenshot: enter image description here

How can I fix this problem? I'm looking for a Bootstrap solution but if that's not possible would be nice if you could help me to fix it with CSS rules.

like image 470
David Moreno García Avatar asked Sep 02 '13 15:09

David Moreno García


People also ask

How do I change the input-group width in Bootstrap?

Change the size of the input groups, by adding the relative form sizing classes like . input-group-lg, input-group-sm, input-group-xs to the . input-group itself.

What is correct about jumbotron in Bootstrap?

A jumbotron indicates a big box for calling extra attention to some special content or information. A jumbotron is displayed as a grey box with rounded corners. It also enlarges the font sizes of the text inside it. Tip: Inside a jumbotron you can put nearly any valid HTML, including other Bootstrap elements/classes.

What is input-group prepend?

input-group class is a container to enhance an input by adding an icon, text or a button in front or behind the input field as a "help text". Use . input-group-prepend to add the help text in front of the input, and . input-group-append to add it behind the input.

How do I get jumbotron in Bootstrap?

To make the jumbotron full width, and without rounded corners, add the . jumbotron-fluid modifier class and add a . container or . container-fluid within.


1 Answers

Last night, I had exactly the same problem. None of the fixes mentioned above worked in my context. What finally did do the job was setting the margin to 0:

.input-group .form-control {     margin: 0px !important; } 

Perhaps this helps someone with a similar problem!

like image 75
goetz Avatar answered Sep 21 '22 18:09

goetz