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;}

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。