Please indicate the source of the reprint: http://blog.csdn.net/zhaoyanjun6/article/details/127229909
This article comes from [Zhao Yanjun's blog]
Article directory
absolute positioning
example
<head>
<style>
.box1 {
width: 100px;
height: 100px;
background-color: tomato;
}
.box2 {
width: 120px;
height: 100px;
background-color: #bfa;
}
</style>
</head>
<body>
<div class="box1">1</div>
<div class="box2">2</div>
</body>
Enable absolute layout
<head>
<style>
.box1 {
width: 100px;
height: 100px;
background-color: tomato;
position: absolute;
}
.box2 {
width: 120px;
height: 100px;
background-color: #bfa;
}
</style>
</head>
<body>
<div class="box1">1</div>
<div class="box2">2</div>
</body>
It can be seen that after box1 enables absolute positioning, box1 is separated from the document flow, and box1 is promoted to a higher level. Box2 moves up to the position of box1.