<div style="background: #0b2e13; width: 500px; height: 500px; color: #fff;" class="d-flex justify-content-center align-items-center">
<h1 class="h1">文字居中</h1>
</div>
文字水平垂直居中效果:
<div style="background: #0b2e13; width: 500px; height: 500px; color: #fff;" class="d-flex justify-content-center align-items-center">
<img src="https://code.z01.com/v4/assets/img/bootstrap-stack.png" alt="" style="width: 200px; height: 200px;">
</div>
图片水平垂直居中效果: