<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<style type="text/css">
.container {
position: relative;
}
.nobox {
width: 100px;
height: 100px;
background-color: green;
}
.box {
position: absolute;
width: 100px;
height: 100px;
background-color: red;
}
.boxs {
width: 100px;
height: 100px;
background-color: yellow;
}
</style>
<div class="container">
<div class="nobox">Box 0</div>
<div class="box">Box 1</div>
<div class="boxs">Box 2</div>
</div>
</body>
</html>
Box 2跑到Box 1下面去了,我需要的是Box 2在Box 1下面的地方,而不是被其遮挡?
好想看没啥好办法
这样符合你的要求不