# Frosted Modal Backdrop

> A tinted, blurred overlay behind a modal, with the same look applied to a native dialog::backdrop.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: modal, dialog, backdrop, blur, overlay, glassmorphism
- Live preview: https://copy-css.com/snippets/frosted-modal-backdrop
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="frost-scrim">
  <div class="frost-modal" role="dialog" aria-modal="true" aria-labelledby="frost-title">
    <h3 id="frost-title">Discard changes?</h3>
    <p>Your edits will be lost.</p>
    <button type="button">Keep editing</button>
  </div>
</div>
```

## CSS

```css
.frost-scrim,
dialog.frost-modal::backdrop {
  background: rgba(15, 23, 42, 0.3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.frost-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.frost-modal {
  width: min(100%, 240px);
  padding: 20px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.45);
  color: #0f172a;
  font-family: system-ui, sans-serif;
}

.frost-modal h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.frost-modal p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 14px;
}

.frost-modal button {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font: 600 14px system-ui, sans-serif;
  cursor: pointer;
}

.frost-modal button:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}
```

## Notes

- This CSS Frosted Modal Backdrop is 53 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses box shadows, backdrop filters, CSS Grid and keyboard focus styles.
- backdrop filters: Includes the -webkit- prefix for older Safari.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
