感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>display table-cell 居中</title>
</head>
<body>
<div class="v-center-table-wrapper">
<div class="v-center-table">
<p>自适应宽高</p>
<p>溢出撑开</p>
<p>我的第一个段落。</p>
</div>
</body>
</html>
输入 JavaScript 代码……
xxxxxxxxxx
*,div,h1,p{margin:0;}
html,body{ height: 100%;}
.v-center-table-wrapper{
width: 100%;
height: 100%;
display: table;
background: #0f0;
}
.v-center-table{
display: table-cell;
text-align: center;
vertical-align: middle;
margin: 30px;
/*配合宽高使用*/
/* 效果查看 */
background: #f69;