/* 相对定位relative:相对于原先的位置进行偏移 */
/* 绝对定位absolute:参照有定位的父盒子,如果父盒子都没有定位,则参照body定位. */
/* 相对定位不会脱标,绝对定位会脱离标准流,因此在布局上采用:
大相小绝/子绝父相! */
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>定位</title>
<style type="text/css">
.bigbox{
/* position: relative;
left: 100px;
top: 400px; */
width: 1000px;
height: 200px;
border: 1px solid red;
}
.bottom{
/* 相对定位relative:相对于原先的位置进行偏移 */
/* 绝对定位absolute:参照有定位的父盒子,如果父盒子都没有定位,则参照body定位. */
/* 相对定位不会脱标,绝对定位会脱离标准流,因此在布局上采用:
大相小绝/子绝父相! */
position: absolute;
top: 300px;
left: 100px;
width: 200px;
height: 200px;
background-color: aqua;
}
.test{
position: fixed;
right: 100px;
bottom: 100px;
width: 400px;
height: 600px;
background-color: #FF0000;
}
</style>
</head>
<body>
<div class="bigbox">
<div class="box"></div>
</div>
<div class="bottom"></div>
<div class="test"></div>
</body>
</html>