Create frosted glass effect with backdrop blur
Quick Answer
Glassmorphism uses `backdrop-filter: blur()` on a semi-transparent `rgba` background to create the frosted glass look popularised in macOS and iOS.
1.glass {
2 background: rgba(255, 255, 255, 0.1);
3 backdrop-filter: blur(10px);
4 -webkit-backdrop-filter: blur(10px);
5 border: 1px solid rgba(255, 255, 255, 0.2);
6 border-radius: 12px;
7}Glassmorphism is a design trend that uses semi-transparent backgrounds, blur, and a subtle border to simulate frosted glass. The backdrop-filter: blur() property blurs whatever is rendered behind the element, while the rgba background and border create the translucent glass appearance.
`backdrop-filter` is supported in Chrome 76+, Safari 9+ (with -webkit- prefix), Firefox 103+, and Edge 79+. Add both the prefixed and unprefixed versions for full coverage.
This free css code snippet for glassmorphism effect is production-ready and copy-paste friendly. Whether you are building a web app, API, or frontend interface, this intermediate-level example will help you implement glassmorphism effect quickly and correctly.
All snippets in the Snippetly library follow css best practices and are tested for real-world use. You can adapt this code to work with React, Vue, Node.js, or any project that uses css.
Organise your team's code snippets with Snippetly. Share knowledge and boost productivity across your organisation.