Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap input group 1px diference

I use input-group in modal dialog. And the button is 1px less then other elements. How can I fix it, more then less why I have this bug? I use Bootstrap 3

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<div class="buttons input-group col-sm-offset-1 col-sm-9">
    <input type="number" min="1" value="1" class="form-control" />
    <span class="input-group-addon">ks</span>
    <span class="input-group-btn">
        <button type="button" class="btn btn-default glyphicon glyphicon-remove color-red"/>
    </span>
</div>
like image 995
Peter Avatar asked Apr 02 '15 12:04

Peter


People also ask

What is the difference between input group and form group?

Using input groups you can easily prepend and append text or buttons to the text-based inputs. For example, you can add the $ symbol, @ for a Twitter username, or anything else as required. Form groups are used to wrap labels and form controls in a div to get optimum spacing between the label and the control.

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 reduce the size of a text box in bootstrap?

We can also adjust the size of input elements in bootstrap by the use of classes like . input-lg and . input-sm for adjusting heights and . col-lg* and .


1 Answers

For me, the bug was because of a rounding error.

there's this style rule

.btn {
    line-height: 1.42857;
}

which should be

.btn {
    line-height: 1.42857143;
}

Turns out importing bootstrap within other SASS files resulted in a loss of precision. The SASS compile process needed the flag --precision 8 to work correctly.

For you, though, as noted in another answer, you just need to put your icon in another tag.

<span class="input-group-btn">
    <button type="button" class="btn btn-default color-red">
        <span class="glyphicon glyphicon-remove"></span>
    </button>
</span>
like image 83
Joseph Nields Avatar answered Oct 04 '22 01:10

Joseph Nields