主要为了实现span在div中垂直居中
下面代码
<div class="col-md-4 bg-danger">
<div style="display: flex; flex-direction: column; justify-content: center; text-align: center; height: 100%">
<span style="font-size:36px">100.00%</span>
</div>
</div>
下面是效果


本文介绍了一种使用Flexbox布局实现在div容器内span元素垂直居中的方法。通过设置display为flex,flex-direction为column,justify-content为中心对齐,使得内部span元素能够水平垂直居中显示。
631

被折叠的 条评论
为什么被折叠?



