Which way to use form-group bootstrap?

2

Which way to use form group?

I use the following way

    <div class="row">
        <div class="col-md-2" align="center">
            <span class="glyphicon glyphicon-user" style="font-size:60px"></span>
        </div>
        <div class=" col-md-10">
            <form class="form-group" role="form">
                        <div class="row">
                            <div class="form-group">
                                <div class="col-md-10">
                                    <label>Nome</label>
                                    <input type="text" class="form-control">
                                </div>
                                <div class="col-md-2">
                                    <label>Situação</label>
                                    <select class="form-control">
                                        <option>Ativa</option>
                                        <option>Inativa</option>
                                    </select>
                                </div>
                            </div>
        </div>
    </form>
</div>

and by taking the form-group it works,

leaving it to the input and the select it works

leaving form-group to face one of the components, it works ...

Which way is correct?

    
asked by anonymous 14.08.2014 / 21:32

1 answer

4

The idea is that .form-group "replace" .row , being as follows:

<form role="form">
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
  </div>
</form>
  

All contents <input> , <textarea> and <select> of these elements with   .form-control are configured with width: 100% ; by default. Place   labels and controls within the .form-group to get a spacing   best. Bootstrap Documentation

    
19.08.2014 / 17:31