定位:
相对定位 relative 相对于自身的位置进行定位 设置偏移量是使用 top left right bottom,不脱离文档流,不影响其他的元素。
绝对定位 absolute
固定定位 fixed
相对定位
.box1{
width: 200px;
height: 200px;
background-color: red;
}
.box2{
width: 200px;
height: 200px;
background-color: blue;
position: relative;
left: 200px;
}
.box3{
width: 200px;
height: 200px;
background-color: green;
}
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
相对于自身进行定位,设置偏移量是使用 top left right bottom,不脱离文档流,不影响其他的元素。
绝对定位
.box1 {
width: 200px;
height: 200px;
bac