Bootstrap 4 引导程序4:如何将卡居中

Bootstrap 4 引导程序4:如何将卡居中,bootstrap-4,Bootstrap 4,我正在使用Bootstrap4构建一个学校网站模板 我用一张卡片做员工页面。但是我不能把卡片居中 这是我的密码: <div class="card text-center" style="width: 21.5em;"> <img class="card-img-top" src="images/placeholder.jpg" alt="Card image cap"> <div class="card-body"> <h5 c

我正在使用Bootstrap4构建一个学校网站模板

我用一张卡片做员工页面。但是我不能把卡片居中

这是我的密码:

<div class="card text-center" style="width: 21.5em;">
   <img class="card-img-top" src="images/placeholder.jpg" alt="Card image cap">
   <div class="card-body">
      <h5 class="card-title">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>
   </div>
</div>

头衔

一些基于卡片标题的快速示例文本,构成了卡片内容的大部分

如何解决此问题?

您可以使用:

style="width: 21.5em;margin:0 auto;"

您的卡将居中。

居中,在哪里?哪条路?对应的代码在哪里?