【发布时间】:2015-03-01 20:20:03
【问题描述】:
我在互联网上搜索了我的问题,我总是找到相同的解决方案,但它对我不起作用.. 我的代码中的某些内容与中的“垂直居中”动态内容的示例不同一个分区。
我有这个网页 http://staging.karlienfabre.be/pocoloco/reizen/canyoning.html
问题出在第一个黄色部分。我希望左边的文字垂直居中;但是文本可以有不同的长度;右边的白框也应该垂直居中。
此时html看起来是这样的
<div class="container yellow-content">
<div class="row center-vertical">
<div class="col-md-7 vertical-center-element">
<h2>Actie en avontuur</h2>
<p>
540 smith grind grind hang up launch ramp. Sponsored gnarly no comply regular footed hang-up. Quarter pipe tic-tac aerial hang ten airwalk. Deck baseplate crail grab bluntslide regular footed. Varial carve darkslide ollie hole Vans Calfornia Daze rocket air. Pivot kick-nose ollie sketchy death box Steve Rocco.
</p>
</div>
<div class="col-md-3 col-md-offset-1 bgwhite vertical-center-element">
<div class="row text-center">
<div class="col-md-6 col-md-offset-3">
<div class="text-center testimonial">
<a href=""> <img class="img-circle img-responsive" src="../img/reisaanbod/testimonials/testi_canyoning.jpg" alt=""> </a>
</div>
</div>
</div>
<div class="row text-center">
<div class="row-md-9">
<p>Tic-tac nollie bearings Ron Allen disaster. Downhill blunt no comply Kevin Jarvis slob air. Deck Brooklyn Banks indy grab slap maxwell pop shove-it.</p>
</div>
</div>
</div>
</div>
</div>
我认为很重要的css
.row.center-vertical{
display: table;
}
.vertical-center-element{
display: table-cell;
vertical-align: middle;
}
我找不到我做错了什么或导致居中无法正常工作的原因。
提前致谢!
【问题讨论】:
标签: html css vertical-alignment centering