<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>登录</title>
</head>
<body >
<div class="main">
<div id="container"></div>
</div>
<style>
.main{
text-align: center;
background-color: #fff;
border-radius: 20px;
width: 300px;
height: 350px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
/* .main{
text-align: center; /*让div内部文字居中*/
background-color: #fff;
border-radius: 20px;
width: 300px;
height: 350px;
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
} */
}
</style>
</body>
</html>
![](https://img2020.cnblogs.com/blog/1261986/202008/1261986-20200811223216815-209961881.png)
![](https://img2020.cnblogs.com/blog/1261986/202008/1261986-20200811223239716-712965906.png)
https://blog.csdn.net/qq_32623363/article/details/77101971?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight