Center element with bootstrap

Asked

Viewed 62 times

0

Colleagues. I have the code below, but I’m not able to centralize the form. I’m using the latest version of Bootstrap. I tried to put align="center", but it didn’t work either. Look:

<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> 

1 answer

2


The problem is on this line:

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

To center using only bootstrap 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 his margin and the margin class col-sm-offset-X bootstrap, if it’s just the margin-top who wants, can do this way

  • Perfect Miguel. Thank you.

  • You’re welcome @Fox.11.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.