什么是垂直对齐列中间文本的最佳方式?图像高度在CSS中静态设置。Bootstrap如何让文本垂直对齐在div容器中
我已经尝试设置一个外部div到display: table
和一个内部div到display: table-cell
与vertical-align: middle
但这也没有效果。
HTML
<section id="browse" class="browse">
<div class="container">
<div class="row">
<div class="col-md-5 col-sm-5">
<h2 class="text-left">Link up with other gamers all over the world who share the same tastes in games.</h2>
</div>
<div class="col-md-1"></div>
<div class="col-md-6 col-sm-7 animation_container">
<img id="animation_img2" class="animation_img animation_img2" src="images/section2img2.png"/>
<img id="animation_img1" class="animation_img animation_img1" src="images/section2img1.png"/>
</div>
</div>
</div>
</section>
CSS
.browse .container, .blind_dating .container { padding-bottom: 0; }
.animation_container { position: relative; }
.browse .animation_container { height: 430px; }
.animation_img { position: absolute; bottom: 0; }
.animation_img1 { right: 25%; }
.animation_img2 { right: 25%; }
非常感谢!很高兴知道'line-height'技巧! – 2014-08-28 00:28:29
@TheNomad - 任何时候!是的,记住垂直对齐是一个很好的技巧。 – Fizzix 2014-08-28 00:29:32