我想居中居中垂直居中文本,当元素高度未知时?当元素高度未知时垂直居中
HTML
<div class="table">
<div class="table-resp">
<div class="second-row">
<div class="col-md-5">
<div class="left-col-text">
Center vertically
</div>
</div>
<div class="col-md-7">
<div class="right-col-text">
<div class="example">Ex1</div>
<div class="example">Ex2</div>
<div class="example">Ex3</div>
</div>
</div>
</div>
</div>
</div>
CSS
/* CSS used here will be applied after bootstrap.css */
.table{
text-align: center;
padding-top: 70px;
padding-left: 0px;
padding-right: 35px;
}
.table-resp{
border: 1px solid green;
overflow-x: hidden;
}
.text1{
float: left;
display: inline-block;
}
.second-row{
line-height: 30px;
clear: left;
min-height: 30px;
overflow: auto;
}
.left-col-text{
height: 100%;
}
元素 “练习1,实例2” 数是未知的,所以,如果有更多的,显然,该表行会得到身高更大。我需要一些解决方案,这将是响应这也...
https://www.codeply.com/go/bp/4ZEUS7Q7lm
https://css-tricks.com/centering-in-the-unknown/ – CBroe