Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How put select label on the left in bootstrap

I have this problem:

enter image description here

And this is my code:

<form class="form-horizontal">
    <div class="row">
        <div class="col-sm-2">
            <div class="form-group">
                <label class="control-label">Select list:</label>
                <select class="form-control">
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                </select>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="form-group">
                <label class="control-label" style="display: inline-block;">Select list:</label>
                <select class="form-control">
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                </select>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="form-group">
                <label class="control-label">Select list:</label>
                <select class="form-control">
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                </select>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="form-group">
                <label class="control-label">Select list:</label>
                <select class="form-control">
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                </select>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <button class="btn btn-default">Filtra</button>
            </div>
        </div>
    </div>
    </form>

how can I get the label side by side the select? I have tried with the form-horizontal but doesn't work.

Thanks

like image 855
Piero Avatar asked Oct 19 '22 02:10

Piero


2 Answers

use form-inline instead of form-horizontal and you can also use this link for your references http://getbootstrap.com/css/#forms

like image 164
Vivek Vadoliya Avatar answered Oct 21 '22 02:10

Vivek Vadoliya


Add form-inline class to your <form> tag Like so:

<form class="form-inline">
like image 40
Juha Tauriainen Avatar answered Oct 21 '22 01:10

Juha Tauriainen