CSS实现可变行数垂直居中

  

<html>
<head>
<style>
.vcenter {
position: relative;
height: 100%;
width:50px;
}
.vcenter-child {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
margin: auto;
display: table;
text-align: center;
}
</style>
</head>
<body>
<div class="vcenter">
        <div class="vcenter-child">vertical-centering, 我要垂直居中vertical-centering, 我要垂直居中</div>
    </div>
</body>
</html>

  

posted @ 2016-12-24 19:51  xnuwu  阅读(319)  评论(0编辑  收藏  举报