对话框用于点击按钮时显示对话框或一个盒子模型。
类名 | 类型 | |
---|---|---|
modal | 组件类 | Container element |
modal-box | 组件类 | The content of modal |
modal-action | 组件类 | Container for modal action buttons |
modal-backdrop | 组件类 | The backdrop that covers the back of modal so we can close the modal by clicking outside |
modal-toggle | 组件类 | For hidden checkbox that controls modal |
modal-open | 装饰类 | Add/remove this class to open/close the modal using JS |
modal-top | 响应类 | Moves the modal to top |
modal-bottom | 响应类 | Moves the modal to bottom |
modal-middle | 响应类 | Moves the modal to middle (default) |
<dialog>
element: It needs JS to open but it has better accessibility and we can close it using Esc key<input type="checkbox">
and <label>
to check/uncheck the checkbox and open/close the modal<a>
anchor links: A link adds a parameter to the URL and you only see the modal when the URL has that parameterThis modal works with a hidden checkbox!
You've been selected for a chance to get one year of subscription to use Wikipedia for free!