<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>水平垂直居中</title>
<style rel="stylesheet" type="text/css">
.container {
position: relative;
width: 500px;
height: 500px;
border: 1px solid #000;;
}
.content {
position: absolute;
background: red;
width: 200px;
height: 100px;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
内容区
</div>
</div>
</body>
</html>
qqqw
最新推荐文章于 2024-07-18 15:09:01 发布