I am trying to center an absolute button in a div (in the bottom), but it seems to not be working.. Here's what I'm doing for now:
.mc-item {
background: #F0F0F0;
border: 1px solid #DDD;
height: 140px;
padding: 20px;
}
.mc-item a {
position: absolute;
bottom: -19px;
left: 50%;
}
.mc-item p {
text-align: center;
}
<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="col-md-4 col-sm-12">
<div class="mc-item">
<p>Changez votre adresse email ou votre mot de passe.</p>
<a asp-controller="MyAccount" asp-action="Settings" class="btn btn-primary">Paramètres</a>
</div>
</div>
This gives the following result:
What I want is the button centered in the middle. Does the left: 50%
takes in consideration the whole .col div
? I tried wrap the button
in a div
and div
's width becomes 380 which is the same as the .col div
(not the div
with the <p>
).