div文本垂直居中(div text vertical aligan)


.box{
width: 135px;
height: 84px;
display: block; overflow: hidden;

}

.container { background:darkcyan; width: 135px; height: 84px; display: table; } .container p { display: table-cell; vertical-align: middle; word-break: break-all; text-align: center; }
<div class="box">
 <div class="container">
       <p>ally and horifffffffffffffffffffffffffffally.</p>
 </div>
</div>

效果如下

ally and horifffffffffffffffffffffffffffally.

posted @ 2016-07-20 21:48  N1900  阅读(356)  评论(0编辑  收藏  举报