首页 > 其他 > 详细

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

时间:2019-12-04 23:44:36      阅读:117      评论:0      收藏:0      [点我收藏+]

<!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>

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

原文:https://www.cnblogs.com/lishuide/p/11986331.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!