fe-interview icon indicating copy to clipboard operation
fe-interview copied to clipboard

[html] 第351天 你知道什么是粘性布局吗?

Open haizhilin2013 opened this issue 6 years ago • 2 comments

第351天 你知道什么是粘性布局吗? 我也要出题

haizhilin2013 avatar Mar 31 '20 21:03 haizhilin2013

MDN 是这样解释的:

Sticky positioning can be thought of as a hybrid of relative and fixed positioning. A stickily positioned element is treated as relatively positioned until it crosses a specified threshold, at which point it is treated as fixed until it reaches the boundary of its parent.

中文大概意思: 对象在常态时遵循常规流。它就像是relative和fixed的合体,当在屏幕中时按常规流排版,当卷动到屏幕外时则表现如fixed。该属性的表现是现实中你见到的吸附效果。

image

amyhuangxbd avatar Apr 01 '20 05:04 amyhuangxbd

an example: https://github.com/wesbos/JavaScript30/tree/master/24%20-%20Sticky%20Nav

rachelcdev avatar Apr 01 '20 17:04 rachelcdev