CSS ::backdrop All In One
CSS ::backdrop All In One
dialog
/* Backdrop is only displayed when dialog is opened with dialog.showModal() */
dialog::backdrop {
background: rgba(255, 0, 0, 0.25);
}
https://developer.mozilla.org/en-US/docs/Web/CSS/::backdrop
dialog
tag
When using HTMLDialogElement.showModal()
to open a <dialog>
, focus is set on the first nested focusable
element.
使用 HTMLDialogElement.showModal()
打开 <dialog>
时,焦点设置在第一个嵌套的可聚焦
元素上。
The ::backdrop
CSS pseudo-element can be used to style the backdrop that is displayed behind a <dialog>
element when the dialog is displayed with HTMLDialogElement.showModal()
.
For example, to dim unreachable content behind the modal dialog.
当使用 HTMLDialogElement.showModal()
显示对话框时,::backdrop
CSS 伪元素可用于设置显示在 <dialog>
元素后面的背景的样式。
例如,使模态对话框
后面无法访问的内容变暗。
Because this dialog was opened via the open
attribute, it is non-modal.
因为这个对话框是通过 open
属性打开的,所以它是非模态的
。
Opening dialogs via HTMLDialogElement.show()
is preferred over the toggling of the boolean open attribute.
通过 HTMLDialogElement.show()
打开对话框优于布尔 open 属性的切换。
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/show
:modal
https://developer.mozilla.org/en-US/docs/Web/CSS/:modal
https://codepen.io/xgqfrms/pen/oNPWvdK
https://codepen.io/xgqfrms/pen/oNPWvQv?editors=1011
demos
video
video::backdrop {
background-color: #448;
}
https://mdn.github.io/css-examples/backdrop/index.html
refs
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/17174223.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2022-03-03 Array.flat All In One
2022-03-03 GitLab delete repository Tutorials All In One
2022-03-03 iPhone 无法开启屏幕录制 bug All In One
2022-03-03 React Fiber 架构剖析与实践 All In One
2021-03-03 js Object merge duplicate bug All In One
2021-03-03 ES6 Arrow Function & this bug
2020-03-03 VSCode & useful Extensions All In One