2019-12.04-固定定位-层级元素

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>元素层级</title>
</head>
<style type="text/css">
.con{
width: 400px;
height: 400px;
border:1px solid #000;
margin: 100px auto 0;
position: relative;
}

.con div{
width: 200px;
height: 100px;
margin: 20px;
background-color: gold;
text-align: center;
line-height: 100px;
font-size: 40px;

position: absolute;
}

body .box1{
background-color: green;
z-index: 10;
}

body .box2{
background-color: pink;
left: 30px;
top: 30px;
}

body .box3{
left: 60px;
top: 60px;
z-index: 11;
}


</style>
<body>

<div class="con">
<div class="box1">1</div>
<div class="box2">2</div>
<div class="box3">3</div>
</div>

<div class="box4">第4个盒子</div>


</body>
</html>

posted @ 2019-12-04 22:49  李俊鹏Python  阅读(207)  评论(0编辑  收藏  举报