#优质博文 #css #前端 #浏览器 #新特性
Use overscroll-behavior: contain to prevent a page from scrolling while a <dialog> is open
author Bramus!
Use overscroll-behavior: contain to prevent a page from scrolling while a <dialog> is open
AI 摘要:文章介绍了 Chrome 144 对 CSS 属性 overscroll-behavior 的改进:该属性现在在“不可滚动的滚动容器”上也有效,这意味着开发者可以用简单的 CSS 代码阻止页面在对话框(<dialog>)打开时滚动。作者解释了这一特性的技术背景、过去的限制及其在不同浏览器支持上的现状,并展示了一个实现示例。
author Bramus!