垂直居中
</div>
</div>
</body>
<meta charset="UTF-8">
<title>居中</title>
<style>
*{
padding: 0;
margin: 0;
}
.box{
width: 500px;
height: 400px;
background: red;
margin: 100px;
//border: 2px;
}
.child{
position: absolute;
width: 200px;
height: 150px;
background: blue;
margin: 125px 150px;
}
</style>
</head>
<body>
<div class="box">
<div class="child"></div>
</div>
</body>
在整个窗口中固定居中,定位+margin值
技巧性方法,通过设置bottom top left right margin来实现
</body>