我想垂直居中。我试过在顶部设置填充,并设置垂直对齐但不适用于移动视图。有人可以帮忙吗?
<div style="padding-top:200px;vertical-align: middle;" align="center">
This is testing content
</div>
答案 0 :(得分:0)
.box {
width: 100px;
height: 100px;
background-color: red;
flex: 1 0 0;
margin: 3px;
position: relative;
}
.box_text {
color: #ffffff;
font-size: 20px;
font-weight: bold;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
}
&#13;
<div class="box"><span class="box_text">0</span></div>
&#13;
答案 1 :(得分:0)
.content_center {
display: flex;
justify-content: center;
align-items: center;
width: 250px;
height: 150px;
border : 1px solid black;
}
&#13;
<div class="content_center col-md-6">
Div Content
</div>
&#13;