01 绝对定位
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>绝对定位</title>
<style>
* {
margin: 0;
padding: 0;
}
img {
width: 300px;
}
#container {
width: 900px;
height: 900px;
border: 3px solid #871192;
position: absolute;
left: 150px;
top: 150px;
}
#header02{
position: absolute;
left: 150px;
top: 150px;
}
</style>
</head>
<body>
<div id="container">
<img id="header01" src="./img/1.png" alt="">
<img id="header02" src="./img/1.png" alt="">
</div>
</body>
</html>
![在这里插入图片描述](https://img-blog.csdnimg.cn/b18c873889ce44e399853b908c4680e9.png#pic_center)
02 相对定位
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>相对定位</title>
<style>
* {
margin: 0;
padding: 0;
}
img {
width: 300px;
}
#container {
width: 900px;
height: 900px;
border: 3px solid #871192;
position: absolute;
}
#header02{
position: relative;
left: 150px;
top: 150px;
}
</style>
</head>
<body>
<di