The right way to do this is to use the native Bootstrap class offset-md-"
In your case I suggest passing form-group
col-md-5
to col-md-6
, because being a multiple of 12 you get a perfect alignment on the screen.
Soon your grid would look like this: <div class="col-md-6 offset-md-3">
(this means that it has a left and a right space in the size of 3 columns, and the 6 column form is centered in the middle of the screen .
To center the image use the Bootstrap native Flex properties: d-flex justify-content-center
Official BS4 Grid Documentation: link
Official Flex BS4 documentation: link
See the result in the example below:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="form-group d-flex justify-content-center">
<img src="http://placeskull.com/100/100"width="100px" alt="Fuzzy Cardigan"
class="img-thumbnail img-responsive" >
</div>
<div class="container ">
<form action="" method="POST" name="formulario" >
<div class="form-group">
<div class=" col-md-6 offset-md-3">
<label > Usuário ou E-MAIL</label>
<input type="text" name="login" class="form-control " placeholder=" Usuário ou E-MAIL" required="" >
</div>
</div>
<div class="form-group">
<div class="col-md-6 offset-md-3">
<label> SENHA </label>
<input type="password" name="rg" class="form-control" placeholder="SENHA" required="" >
</div>
</div>
<div class="form-group">
<div class="col-md-6 offset-md-3">
<input type="submit" value="Login" class="btn btn-primary" name="">
<div class="form-check">
<label > <input class="form-check-input" type="checkbox" value="" > Lembre-me </label>
</div>
</div>
</div>
</form>
</div>
OBS: I also put the buttons inside the form-group
so I can align them along with the rest of things.