<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body{
background-color: skyblue;
}
.box{
width: 400px;
height: 300px;
border-radius: 2px;
background-color: pink;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
</style>
<body>
<div class="box"></div>
</body>
</html>
css让子div左右上下居中
最新推荐文章于 2024-01-30 22:59:15 发布