第六周做业(sticky

position: sticky.net

基于用户的滚动位置来定位。
粘性定位的元素是依赖于用户的滚动,在 position:relative 与 position:fixed 定位之间切换。
在目标区域之内,它的行为就像 position:relative; 而当页面滚动超出目标区域时,它的表现就像 position:fixed;,它会固定在目标位置。
元素定位表现为在跨越特定阈值前为相对定位,以后为固定定位。
这个特定阈值指的是 top, right, bottom 或 left 之一,换言之,指定 top, right, bottom 或 left 四个阈值其中之一,才可以使粘性定位生效。不然其行为与相对定位相同。

摘自:https://blog.csdn.net/yesyoucan_/article/details/80506742blog

相关文章
相关标签/搜索