Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use .input-append with a .form-inline?

I am new to Twitter Bootstrap and am starting to fumble my way through its use. While certain aspects of the framework are starting to make sense I am still struggling with form styling. I am trying to setup several different sections of a form which will have elements that are styled utilizing .form-inline. In one such instance I am also attempting to use .input-append with little luck.

<div class="row">
    <div class="well span12">
        <div class="row">
            <div class="span12 form-inline input-append">
                <label for="assetSearch">Asset Search</label>
                <input type="search" id="assetSearch" placeholder="">
                <span class="add-on"><i class="icon-search"></i></span>
            </div>
        </div>
        <div class="row">
            <div class="span12 form-inline">
                <label for="service">Service</label>
                <input type="text" id="service" autocomplete="off" />
            </div>
        </div>
    </div>
</div>

The above markup renders like this:

screenshot of how the above markup renders

As you can see "Asset Search" is not inline with the form input. If i remove the .input-append class from the containing div things line up. However, the search icon is no longer embedded in the text box, but instead to the right of text box.

How can I use .form-inline in cunjunction with .input-append?

like image 740
ahsteele Avatar asked Nov 13 '22 11:11

ahsteele


1 Answers

You should not put inside a input-append (or prepend) anything else than inputs, buttons or .add-ons (this might not be exhaustive).

Try wrapping the whole thing into a div.input-append and let the .form-inline handle the floating : Demo on jsfiddle

<div class="span12 form-inline">
    <label for="assetSearch">Asset Search</label>
    <div class="input-append">
        <input type="search" id="assetSearch" placeholder="" />
        <span class="add-on"><i class="icon-search"></i></span>
    </div>
</div>
like image 66
Sherbrow Avatar answered Nov 15 '22 12:11

Sherbrow