【发布时间】:2021-12-05 16:53:27
【问题描述】:
我正在尝试在我的卡片之间放置空间。
我有 4 张卡并排在一起。但是当我在卡片 div 上使用mr-3 时,最后一张卡片在下面。我不希望这种情况发生。
如何让所有 4 张卡片之间有空格并在同一行/行中?
我也尝试了d-flex justify-content-around,但它不起作用。
下面是我的代码
<div class="container">
<div class="row">
<div class="card col-md-3">
<img src="..." class="card-img-top" alt="...">
<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>
<div class="card col-md-3">
<img src="..." class="card-img-top" alt="...">
<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>
<div class="card col-md-3">
<img src="..." class="card-img-top" alt="...">
<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>
<div class="card col-md-3">
<img src="..." class="card-img-top" alt="...">
<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>
</div>
</div>
【问题讨论】:
-
您不能使用
.card-columns、.card-deck或.card-group吗? -
您好,感谢您的回复。我不知道这些。我会试试的,非常感谢!
标签: html bootstrap-4