6、定位
6.1、相对定位
- 相对定位:position:relative
- 相对于原来的位置,进行指定的偏移,相对定位任然在标准文档流中,原来的位置会被保留
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body{
padding: 20px;
}
div{
margin:15px;
padding: 5px;
font-size: 15px;
line-height: 25px;
}
#father{
border: 2px solid #CE4A50;
padding: 0;
}
#first{
border: 2px solid #3d6694;
background-color: #CE4A50;
position: relative;
top: 20px;
}
#second{
border: 2px solid #CE4A50;
background-color: #3d6694;
}
#three{
border: 2px solid #3d6694;
background-color: #CE4A50;
}
</style>
</head>
<body>
<div id="father">
<div id="first">第一个盒子</d