position

Posted on 2018-09-25 13:10  mini7  阅读(77)  评论(0编辑  收藏  举报
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./dsmd.css">
<title>Document</title>
</head>
<body>
<div class="box" id="one">One</div>
<div class="box" id="two">Two</div>
<div class="box" id="three">Three</div>
<div class="box" id="four">Four</div>
</body>
</html>
 
 
dsmd.css
.box {
display: inline-block;
width: 100px;
height: 100px;
background: red;
color: white;
}
 
#two {
position: absolute;//探究position中static、absolute、relative、fixed、sticky的区别
top: 20px;
left: 20px;
background: blue;
}