我怎样才能垂直居中?试过我的汽车课,但它没有工作它仍然放在顶部..有人可以帮我找到问题所在吗?
一些代码:
< div class =“col-12 col-lg-6 mb-5”& …
我添加这样的级别(示例):
.block { border: 1px solid blueviolet; height: 150px; display: table; } .int-box { display: table-cell; vertical-align: middle; }
<div class="block mb-5"> <div class="int-box"> <h2>MACHINE TO MACHINE</h2> </div></div>
加 flex 至 块
flex
.block { border: 1px solid blueviolet; height: 150px; display: flex; align-items: center; justify-content: center; }