相对定位

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>相对定位</title>
<style>
div{
100px;
height:100px;
}
.div1{
background:red;
}
.div2{
background:yellow;
position:relative;
/*position:relative;相对于原来的位置进行定位,不脱离文档流,原来的位置还在。只写这行,不定left、top、right或者bottom的话没效果*/
/*文档流就是从上到下,从左到右*/
left:200px;/*距离原来的位置200px,不是向左移动200px*/
}
.div3{
background:blue;
}
</style>
</head>
<body>
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</body>
</html>

原文地址:https://www.cnblogs.com/benbenma/p/7169569.html