Relative与Absolute组合使用

Posted ljming

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Relative与Absolute组合使用相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title>框架</title>
	<style type="text/css">
	div{border: solid black 1px;}
	h1{
		color: red;
	}
	div{
		background-color: #0fc;
	}
	.box1{
		width: 800px;
		height: 100px;
		position: relative;
	}
	.box2{
		width: 200px;
		height: 300px;
		top: 100px;
		position: absolute;
	}
	.box3{
		width: 400px;
		height: 100px;
		left: 200px;
		top: 100px;
		position: absolute;	
	}
	.box4{
		width: 400px;
		height: 100px;
		left: 200px;
		top: 200px;
		position: absolute;
	}
	.box5{
		width: 400px;
		height: 100px;
		left: 200px;
		top: 300px;
		position: absolute;
	}
	.box6{
		width: 200px;
		height: 300px;
		left: 600px;
		top: 100px;
		position: absolute;
	}
	</style>
</head>
<body>
    <h1>Relative与Absolute组合使用</h1>
    <br>
    <div class="box1">
       <div class="box2"></div>
       <div class="box3"></div>
       <div class="box4"></div>
       <div class="box5"></div>
       <div class="box6"></div>
    </div>
</body>
</html>

  

以上是关于Relative与Absolute组合使用的主要内容,如果未能解决你的问题,请参考以下文章

秒懂相对定位与绝对定位,组合拳relative,absolute 瞬间清醒有木有?

辨析relative与absolute

position属性absolute与relative 详解

position属性absolute与relative 详解

辨析relative与absolute

探究position定位中absolute和relative的异同