- position:fixed他是相对body来定位的,脱离文档流
- position:relative它是相对于自身来变化的,而且不会脱离文档流
- position:absolute脱离文档流,相对于position为非static的父标记定位
<html>
<head>
<title></title>
</head>
<body>
<!--position:fixed他是相对body来定位的,脱离文档流-->
<div style="border: 1px solid black;width: 300px;height: 300px;">
<div class="in" style="width: 100px;height:100px;background-color: red;"></div>
<div class="in" style="width: 100px;height:100px;background-color: yellow;"></div>
<div class="in" style="width: 100px;height:100px;background-color: green;position:fixed;bottom: 20px;right:20px;">
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<!--position:relative它是相对于自身来变化的,而且不会脱离文档流-->
<div style="border: 1px solid black;width: 300px;height: 300px;">
<div class="in" style="width: 100px;height:100px;background-color: red;"></div>
<div class="in" style="width: 100px;height:100px;background-color: yellow;"></div>
<div class="in" style="width: 100px;height:100px;background-color: green;position:relative;bottom: 20px;left:20px;"></div>
</div>
<!--position:absolute脱离文档流,相对于position为非static的父标记定位-->
<div style="border: 1px solid black;width: 300px;height: 300px;">
<div class="in" style="width: 100px;height:100px;background-color: red;"></div>
<div class="in" style="width: 100px;height:100px;background-color: yellow;"></div>
<div class="in" style="width: 100px;height:100px;background-color: green;position:absolute;bottom: 20px;left:20px;"></div>
</div>
</body>
</html>