其他分享
首页 > 其他分享> > 19.相对定位

19.相对定位

作者:互联网

.box{
width: 500px;
height: 300px;
border: solid;
margin:50px auto;
}
.sub-box{
width: 100px;
height: 100px;
}
.bgc1{
background-color: darkorange;
}
.bgc2{
background-color: blue;
}
.bgc3{
background-color: firebrick;
}
.po2{
position: relative;
left: 100px;
top: -100px;
}
.po3{
position: relative;
left: 200px;
top: -200px;
}

<div class="box">
<div class="sub-box bgc1"></div>
<div class="sub-box bgc2 po2"></div>
<div class="sub-box bgc3 po3"></div>
</div>

标签:定位,19,top,100px,height,relative,color,相对,background
来源: https://www.cnblogs.com/wgbl/p/16116721.html