<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/style.css"/>
<title></title>
</head>
<body>
<div id="content">
<div><div>居中</div></div>
</div>
</body>
</html>
#content>div{
width: 500px;
height: 400px;
background:green;
display: table-cell;
vertical-align: middle;
}
#content>div>div{
background-color: red;
text-align: center;
width: 200px;
line-height: 200px;
margin-left: auto;
margin-right: auto;
}