[英]CSS center align div vertically
I want to center align a div veritcally how can I do this?我想垂直居中对齐 div 我该怎么做?
<!DOCTYPE html>
<html>
<head>
<title>HTML/CSS</title>
<style type="text/css">
#box {
display: flex;
width: 200px;
height: 120px;
background: red;
margin: auto;
vertical-align: center;
}
</style>
</head>
<body>
<div id="box">Hello World!</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.