全屏
<dialog>
  <p>Hello world. Click on the button.</p>
  <form method="dialog">
    <button>OK</button>
  </form>
</dialog>

<button onclick="document.querySelector('dialog').showModal()">Open Dialog</button>
/*   IS-OPEN STATE   */
dialog[open] {
  translate: 0 0;
}

/*   EXIT STATE   */
dialog {
  transition: translate 0.7s ease-out, overlay 0.7s ease-out, display 0.7s ease-out allow-discrete;
  translate: 0 100vh;
}

/*   0. BEFORE-OPEN STATE   */
@starting-style {
  dialog[open] {
    translate: 0 100vh;
  }
}

/* Etc */

body,
button {
  font-family: system-ui;
  font-size:1.5rem;
}

button {
  padding: 1rem;
  background: black;
  color: white;
  border-radius: 1rem;
  border: none;
}
返回