css定位属性中的sticky与scroll的差异与应用场景
很多人搜 sticky 和 scroll 的区别,其实是混淆了概念:sticky 是 position 属性的合法取值(如 position: sticky),而 scroll 根本不是 position 的可选值——它属于 overflow 或滚动行为相关的关键词(比如 scroll-behavior、scroll-snap-type),也出现在 JS 的 window.scroll() 等 API 中。两者不在同一语义层,不能直接对比“定位效果”。真正该比的是 sticky 和 fixed、relative 这类定位行为。