fe-interview
fe-interview copied to clipboard
[html] 第351天 你知道什么是粘性布局吗?
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。该属性的表现是现实中你见到的吸附效果。

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