Skip to content

Instantly share code, notes, and snippets.

@webprogramozo
Last active May 16, 2024 13:32
Show Gist options
  • Save webprogramozo/9684826e469e5dc375e98f65559e1509 to your computer and use it in GitHub Desktop.
Save webprogramozo/9684826e469e5dc375e98f65559e1509 to your computer and use it in GitHub Desktop.
Bootstrap modal with blurry background (Bootstrap 3,4,5)
/* Compatible with Bootstrap 3 and 4 */
body.modal-open > :not(.modal) {
-webkit-filter: blur(1px);
-moz-filter: blur(1px);
-o-filter: blur(1px);
-ms-filter: blur(1px);
filter: blur(1px);
}
/* Compatible with Bootstrap 5, thanks @imikh */
.modal {
-webkit-backdrop-filter: blur(1px);
backdrop-filter: blur(1px);
}
@imikh
Copy link

imikh commented May 5, 2024

Doesn't work in Bootstrap 5.3.
But this one works:

.modal {
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

@webprogramozo
Copy link
Author

Doesn't work in Bootstrap 5.3. But this one works:

.modal {
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

Thanks @imikh for your contribution, gist updated.

@alinlinca10
Copy link

alinlinca10 commented May 16, 2024

Doesn't work in Bootstrap 5.3. But this one works:

.modal {
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

This is working in Bootstrap 5.3+! ✅✅✅

Great, thanks @imikh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment