Good!!!div内水平居中!!!Good


<!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://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

posted @ 2020-06-04 14:29  姜佳泉  阅读(188)  评论(0编辑  收藏  举报