如何移除Firefox macOS下的弹性滚动效果(已解决Chrome端问题)
解决macOS Firefox弹性滚动问题
针对你遇到的macOS Firefox弹性滚动问题,仅给body设置overscroll-behavior-y: none无法生效的原因是Firefox对根元素(html)的滚动行为控制优先级更高,可尝试以下方案:
方案一:同时配置html和body元素
html, body { height: 100%; margin: 0; overscroll-behavior-y: none; overflow-y: auto; }
此方案通过同时锁定html和body的滚动行为,覆盖Firefox默认的弹性滚动逻辑。
方案二:补充Firefox专属属性(兼容旧版)
如果方案一无效,可添加Firefox特定属性强化控制:
html { scrollbar-width: thin; -moz-overflow-scrolling: auto; /* 禁用Firefox的弹性滚动特性 */ } html, body { height: 100%; margin: 0; overscroll-behavior-y: none; overflow-y: auto; }
额外注意
- 若页面内存在嵌套滚动容器,需给对应容器也设置
overscroll-behavior-y: none,避免局部滚动触发全局弹性效果; - 检查页面是否有JS代码修改滚动行为,这类代码可能会覆盖CSS的设置。
内容的提问来源于stack exchange,提问作者Paul
相关产品推荐
相关产品推荐

