我正在嘗試將div內的一些文本垂直對齊到中心,但我無法這樣做。我試過使用顯示方法是表格和表格單元格,但這似乎不起作用。請幫忙。在div中垂直對齊文本
HTML:
<div class="vc_row wpb_row vc_row-fluid blunetser-banner vc_custom_1415005990938">
<div class="vc_col-sm-12 wpb_column vc_column_container">
<div class="wpb_wrapper">
<div class="vc_row wpb_row vc_inner vc_row-fluid blunet-serv-banner-row">
<div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<p>Some text will go here</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.blunetser-banner {
display: table;
height: 300px;
background: #eee;
}
.blunet-serv-banner-row {
display: table-cell;
vertical-align: middle;
}
So..much ... wrappers – timo 2014-11-03 09:38:13
父級應該是'display:table',直接子級'display:table-cell'。你有其他父母的孩子... – jackJoe 2014-11-03 09:38:43
http://stackoverflow.com/questions/2939914/vertically-align-text-in-a-div?rq=1 – 2014-11-03 10:26:05