A modal with :target

Open with a link to #id, close with a link to #.

CSS · A modal with :targetIntermediate
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgb(0 0 0 / 0.55);
  z-index: 100;
}
.modal:target { display: grid; }
.modal .box { width: min(92vw, 480px); padding: 1.5rem; background: #fff; border-radius: 14px; }
modaltargetoverlayno javascript