Center element with bootstrap

0

Colleagues. I have the following code, but I can not centralize the form. I'm using the latest version of Bootstrap. Already tried to put align="center", but also did not work. See:

<div class="container">
        <div class="row">
          <div class="col-md-5" style="margin: 20px">            
                  <form method="post">
                              <label>Faça seu acesso abaixo:</label>
                              <div class="input-group margin-bottom-sm">
                                <span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span>
                                <input class="form-control" type="text" placeholder="Login">
                              </div>
                              <div class="input-group" style="margin-top: 10px">
                                <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
                                <input class="form-control" type="password" placeholder="Senha">
                              </div>
                              <div class="input-group" style="margin-top: 10px">
                                      <button type="submit" class="btn btn-success">Acessar</button>
                              </div>
              </form>
               </div>
        </div>
       </div> 
    
asked by anonymous 30.05.2016 / 21:26

1 answer

2

The problem lies in this line:

<div class="col-md-5" style="margin: 20px">

To center using bootstrap only use offset col-X-offset-Y . Change to:

<div class="col-sm-4 col-sm-offset-4" style="margin-top: 20px">

There was also a conflict between your margin and margin of class col-sm-offset-X bootstrap, if it is only the margin-top you want, you can do this way

    
30.05.2016 / 22:01