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>

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章