父元素display为table时子元素display:table-cell才生效
<div class="text"> <div> <div> 你好 </div> </div> </div>
.text > div { display: table; width: 100%; height: 100% } .text > div > div { display: table-cell; width: 100%; height: 100%; vertical-align: middle; }