position: sticky
时间: 2023-10-25 16:29:45 浏览: 97
position: sticky是一种CSS属性,用于实现粘性布局,也可以理解为实现吸顶效果。它的作用是让某个元素在滚动过程中保持固定位置,同时又不会影响到其他元素的布局。当修饰的目标节点在屏幕中时,它表现为相对定位(relative),当要超出屏幕时,它表现为固定定位(fixed)。这种特性结合了相对定位和固定定位的特点,使得元素在滚动过程中可以保持在指定位置。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [JS解决position:sticky的兼容性问题的方法](https://download.csdn.net/download/weixin_38741950/13206331)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [position: sticky属性的基本使用](https://blog.csdn.net/weixin_43636361/article/details/126707014)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [position:sticky粘性/悬浮定位](https://blog.csdn.net/Chuinj/article/details/130714048)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文