您知道为什么我的绿色DIV没有垂直对准红色DIV的中间,以及如何解决这个问题?非常感谢
http://jsfiddle.net/kAXp9/
.wrapper-alt {
margin-right: auto;
margin-left: auto;
width: 980px;
display:table;
border: 1px solid #000;
}
.bigtext {
color: #124191;
font-weight: 600;
font-size: 53px;
text-align: right;
line-height: 53px;
padding-top: 20px;
padding-bottom: 20px;
}
.block-left-alt, .block-right-alt {
display:table-cell;
vertical-align:middle;
padding:30px 0;
height:100%;
box-sizing: border-box;
}
.block-left-alt {
float: left;
background: red;
display:table-cell;
vertical-align:middle;
height:100%;
width: 50%;
text-align: right;
padding-right: 10px;
}
.block-right-alt {
float: left;
background: green;
display:table-cell;
vertical-align:middle;
height:100%;
width: 50%;
}
<div class="wrapper-alt">
<div class="block-left-alt bigtext">Pourquoi<br>faire appel<br> à nos services?</div>
<div class="block-right-alt"><ul class="bullets1-alt">
<li><i class="fa fa-check"></i> Reason 1</li>
<li><i class="fa fa-check"></i> Reason 2</li>
<li><i class="fa fa-check"></i> Reason 3</li>
</ul>
</div>
</div><!-- End Wrapper -->
最佳答案
去掉
float:left
来自
.block-left-alt
和.block-right-alt
Updated fiddle here.
关于html - 垂直对齐仅部分起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20772299/