<!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>
<style>
body{
margin: 0;
padding: 0;
}
.d1,.d2{
position: relative;
}
.dd1{
width: 100px;
height: 100px;
background-color: blue;
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
.dd2{
width: 100px;
height: 100px;
background-color: red;
position: absolute;
left: 20px;
top: -20px;
z-index: 1;
}
</style>
</head>
<body>
<div class="d1">
<div class="dd1"></div>
</div>
<div class="d2">
<div class="dd2"></div>
</div>
</body>
</html>
z-index定位方法
最新推荐文章于 2022-04-13 19:21:40 发布