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;
}

body .box1{
position: fixed;
left: 0;
top: 0;
background-color: green;
}

.box4{
background-color: pink;
position: absolute;
right: 100px;
bottom: 100px;
}

</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:42  李俊鹏Python  阅读(120)  评论(0编辑  收藏  举报