多个div垂直居中横向排列⾃适应多个div垂直居中横向排列
⽗级div,⼦级div⾼度都为⾃适应。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>垂直居中</title>
<style>
#mine {
width: 500px;
height:500px;
background: #f00;
margin: 0 auto;
display: flex;
}
.center {
/*flex: 1;*/
/*width: 100px;div中的div居中
height: 100px;*/
background: #0f0;
margin:auto;
}
</style>
</head>
<body>
<div id="mine">
<div class="center">⼀</div>
<div class="center">⼆</div>
<div class="center">三</div>
</div>
</body>
</html>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论