css 设置文本垂直居中

html:

<div class="dialog-cont">
       <div class="dialog-stic">
              <p>FedEx Express invented for more than 3.9 million shipments each business day.</p>
       </div>
</div>

 

 css:

.dialog-cont{float: right; width: 630px;height: 130px;margin-right: 10px;display:table;position: static;}
.dialog-stic{position: static;top: 50%;left: 0;display: table-cell;vertical-align: middle;}
.dialog-stic p{color: #fff;font-size: 14px;line-height: 25px;display: block;position: relative;top: -50%;left: 0;padding-right: 10px;text-align:left;text-indent: 2em;}

 

posted on 2015-03-31 18:09  YeWeb  阅读(223)  评论(0编辑  收藏  举报

导航