Master the glassmorphism CSS technique — from core properties to accessibility, performance, and real-world implementation patterns.
Glassmorphism has become one of the defining visual styles of modern UI design. With its frosted glass aesthetic, translucent layers, and subtle depth cues, it creates interfaces that feel premium, modern, and alive. From Apple's macOS and iOS to Windows 11, major platforms have embraced this style, making it a must-know technique for frontend developers and designers. In this guide, we will break down exactly how glassmorphism works, the CSS properties involved, when to use it (and when not to), and how to implement it accessibly. You can also use our free glassmorphism CSS generator to create custom glass effects visually.
Glassmorphism (sometimes called "frosted glass UI") is a design technique that creates the illusion of frosted, translucent glass overlaid on content. The effect is characterized by four key visual properties:
backdrop-filter: blur() property that creates the frosted appearanceThe result is an element that feels like it is floating above the content behind it, with a soft, diffused view of what lies beneath. This creates a natural sense of hierarchy and depth that flat design alone cannot achieve.
Glassmorphism relies on just a handful of CSS properties. Here is the minimal implementation:
.glass-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 16px;
}
Let us break down each property:
background: rgba(255, 255, 255, 0.1) — A white background at 10% opacity. Adjust the alpha value (0.05-0.3 range is typical) to control how much the glass shows through. For dark themes, use rgba(0, 0, 0, 0.2) instead.backdrop-filter: blur(10px) — The star of the show. This applies a Gaussian blur to whatever content is behind the element. The 10px value is a good starting point; increase for a more frosted look, decrease for subtlety.-webkit-backdrop-filter: blur(10px) — Safari requires the prefixed version. Always include both.border: 1px solid rgba(255, 255, 255, 0.2) — A thin, translucent border that simulates light refracting at the edge of glass. Without this, the glass effect looks flat.border-radius: 16px — Rounded corners enhance the glass illusion. Sharp corners break the metaphor.The basic recipe works well, but you can create more sophisticated effects by layering additional properties.
.glass-gradient {
background: linear-gradient(
135deg,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.05) 100%
);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
The gradient gives the glass a directional quality, as if light is hitting it from one angle. Combined with box-shadow, this creates a much more realistic three-dimensional appearance.
.glass-vibrant {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px) saturate(180%);
-webkit-backdrop-filter: blur(16px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 20px;
}
Adding saturate() to the backdrop filter makes the blurred background colors more vivid, creating a more vibrant glass effect. This is the style Apple uses heavily in macOS.
Glassmorphism requires interesting content behind the glass element to work. A frosted glass card on a plain white background is invisible — there is nothing to blur. The effect shines when placed over:
/* A colorful background for glass elements to sit on */
.page-background {
background:
linear-gradient(135deg, #667eea 0%, #764ba2 100%),
url('background-image.jpg');
background-size: cover, cover;
min-height: 100vh;
}
.glass-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
background: rgba(15, 23, 42, 0.7);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding: 12px 24px;
}
A glass navigation bar is one of the most common and effective uses. It provides a sense of depth while keeping navigation controls readable. As the user scrolls, the glass effect ensures the nav blends naturally with whatever content passes behind it.
.glass-modal {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 24px;
padding: 2rem;
max-width: 480px;
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}
Modals with glassmorphism feel less intrusive than solid-background modals. The frosted effect creates a clear visual hierarchy between the modal and the background without completely obscuring the underlying content.
In data-heavy interfaces like analytics dashboards, glassmorphism cards add visual sophistication while maintaining readability. Use a slightly higher opacity (0.12-0.18) and pair with clear typography for best results.
WCAG 2.1 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Semi-transparent backgrounds make this harder to achieve. Test your glass components with a contrast checker and adjust background opacity or text color accordingly. If you cannot achieve sufficient contrast with the glass effect, add a subtle darkening overlay behind the text content.
.glass-card {
/* Fallback for browsers without backdrop-filter */
background: rgba(30, 41, 59, 0.95);
/* Glass effect for supported browsers */
@supports (backdrop-filter: blur(10px)) {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
}
The @supports feature query ensures that browsers without backdrop-filter support still get a usable, readable component. This is critical for older browsers and some mobile browsers where backdrop-filter may be unavailable or buggy.
If your glassmorphism includes animated background effects (moving gradients, particle effects behind the glass), respect prefers-reduced-motion:
@media (prefers-reduced-motion: reduce) {
.animated-background {
animation: none;
}
}
backdrop-filter: blur() is a GPU-accelerated operation in modern browsers, but it can still be expensive — especially on large elements or when multiple glass layers are stacked. Here are some optimization tips:
will-change — Add will-change: backdrop-filter to glass elements that animate or change frequently.By 2026, glassmorphism has matured beyond its initial hype phase. The current trends include:
border-image or pseudo-elements to create gradient borders that follow the glass edge.Customize blur, opacity, borders, and more with a visual generator.
Try the Free Generator →Glassmorphism is a UI design style that creates a frosted glass effect using CSS properties: backdrop-filter: blur() for the frosted appearance, semi-transparent backgrounds using rgba() or hsla(), subtle borders, and colorful backgrounds behind the glass element. It gives elements a translucent, layered look that lets background content show through with a soft blur.
The core CSS recipe is: a semi-transparent background (like rgba(255,255,255,0.1)), backdrop-filter: blur(10px) with the -webkit- prefix, and a subtle border (1px solid rgba(255,255,255,0.2)). You also need a colorful or image-based background behind the glass element for the blur to be visible. Add border-radius and box-shadow for a polished look.
Glassmorphism can create accessibility challenges including low contrast between text and background, reduced readability for users with visual impairments, and performance issues on some devices. To make it accessible, ensure WCAG 2.1 color contrast ratios (4.5:1 for normal text), provide solid fallback backgrounds for browsers without backdrop-filter, and test with screen readers and accessibility tools.
backdrop-filter is supported in all modern browsers including Chrome 76+, Firefox 103+, Safari 9+, and Edge 79+. For Safari compatibility, include the -webkit-backdrop-filter prefix. Always provide a fallback background for older browsers that do not support backdrop-filter at all.
Common use cases include fixed navigation bars, modal and dialog overlays, card components in dashboards, login and signup forms, music and media player interfaces, notification toasts, and settings panels. The effect works best when there is rich, colorful content behind the glass element — plain backgrounds make the glass invisible.