<div style="position:absolute;top:500px;left:60px;height:2000px;background-color:yellow;">
This tall div is absolutely positioned 500 pixels from the top and 60 pixels from the left of its containing block.
</div>
<div style="position:fixed;top:100px;left:60px;width:180px;background-color:red;">
This div is using a fixed position of 100 pixels from the top and 60 pixels from the left of its containing block. When this page scrolls, this box will remain in a fixed position - it won't scroll with the rest of the page. Go on - SCROLL!
</div>
absolute绝对定位(相对于整个html流)以及不为人知的(fixed)绝对定位(fixed相对于浏览器窗口=不动的div)...
最新推荐文章于 2023-03-07 20:01:23 发布