<a href="#modal">Open modal</a>

<div class="modal" id="modal" tabindex="-1">
  <a href="#" class="modal__overlay" aria-label="Close modal"></a>
  <div class="modal__content">
    <a href="#" class="modal__close" aria-label="Close modal">&times;</a>
    <div>Modal content</div>
  </div>
</div>
/* --- Required CSS (not customizable) --- */

.modal {
  display: none;
}

.modal:target {
  display: flex;
}

/* --- Required CSS (customizable) --- */

.modal {
  text-align: left;
  backdrop-filter: blur(2px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 2rem;
}

.modal:target {
  justify-content: space-around;
  align-items: center;
}

.modal__overlay {
  position: absolute;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
  cursor: default;
}

.modal__content {
  min-width: 480px;
  position: relative;
  background-color: #f5f5f5;
  padding: 2rem;
}

.modal__close {
  color: initial;
  text-decoration: none;
  position: absolute;
  top: 0;
  right: 0;
  padding: 0 0.5rem;
  display: inline-block;
}

/* --- Codepen styles - not required --- */

body {
  padding: 2rem;
  text-align: center;
  font-size: 2rem;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.