.card .btn {
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%, 50%);
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
您可以通过在按钮上添加以下属性来实现:
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%, 50%);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句