我想把内容集中在这张卡片上
<!-- Card -->
<div class="card card-image h-80" style="background-color:grey;">
<!-- Content -->
<div class="text-white text-center d-flex align-items-center rgba-black-strong py-5 px-4 justify-content">
<div>
<h5 class="pink-text"><i class="fas fa-chart-pie"></i> Your Holdings</h5>
<br>
<br>
<h3 class="card-title pt-2"><strong id="snet-holding">0 </strong> SNET</h3>
<h4 class="card-title pt-2"><strong id="usd-value">0 </strong> USD</h4>
<br>
</div>
</div>
</div>
<!-- Card -->
</div>但出于某种原因,卡内的内容集只有在卡内有值时才会集中。但是如果里面没有内容的话,我也需要以它为中心。当图像处于这种状态时,我需要以内容为中心。

发布于 2020-01-27 09:12:48
应该有justify-content-center类而不是justify-content类。新代码是
<div class="card card-image h-80" style="background-color:grey;">
<!-- Content -->
<div class="text-white text-center d-flex align-items-center rgba-black-strong py-5 px-4 justify-content-center">
<div>
<h5 class="pink-text"><i class="fas fa-chart-pie" aria-hidden="true"></i> Your Holdings</h5>
<br>
<br>
<h3 class="card-title pt-2"><strong id="snet-holding">0 </strong> SNET</h3>
<h4 class="card-title pt-2"><strong id="usd-value">0 </strong> USD</h4>
<br>
</div>
</div>
</div>https://stackoverflow.com/questions/59918110
复制相似问题