2020.11.30web前端第十三课

相对定位与绝对定位的练习

.father{
	width:600px;
	height:400px;
	background:#F63;
	margin:50px auto;
	position:relative;
}
.box1,.box2,.box3,.box4{
	width:80px;
	height:60px;
	background:#F00;
	position:absolute;
	}
.box2{
	right:0;
	top:0;
}
.box3{
	bottom:0;
	right:0;
}
.box4{
	bottom:0;
	left:0;
}

<div class="father">
<div class="box1">div1</div>
<div class="box2">div2</div>
<div class="box3">div3</div>
<div class="box4">div4</div>
</div>

固定定位
position:fixed

posted @ 2020-11-30 21:54  忆清鸣  阅读(27)  评论(0)    收藏  举报