andersch.dev

<2022-05-04 Wed>
[ web ]

HTML

HTML (Hypertext Markup Language) is a Markup language used in web documents and rendered by web browsers.

It primarily follows the syntax <tag attribute="value"></tag>.

Modal without Javascript

<!-- Button to open the modal -->
<button popovertarget="mymodal">Open Modal</button>

<!-- The modal/drawer -->
<dialog popover="auto" id="mymodal">
  <form method="dialog">
    <p>Modal content</p>
    <button onclick="document.getElementById('mymodal').hidePopover()">Close</button>
  </form>
</dialog>

<style>
  dialog           {  border-radius: 8px;                }
  dialog::backdrop { background: rgba(0, 0, 0, 0.5);     }
  button           { padding: 8px 16px; cursor: pointer; }
</style>

Resources