What is glassmorphism in CSS?
Glassmorphism is a visual style where a translucent panel sits over a colorful background and blurs whatever shows through, like frosted glass. The recipe is a semi-transparent background, `backdrop-filter: blur(...)`, a thin border using a low-opacity light color, and a soft box-shadow. The effect adds depth and visual hierarchy without heavy color, making it popular for modals, navbars, and dashboard cards.
Why doesn't my glassmorphism effect work?
The most common reasons are: the element's background is fully opaque (must be semi-transparent for the blur to show), there's nothing colorful behind the element to blur, or `backdrop-filter` isn't supported. Add `-webkit-backdrop-filter` for Safari, ensure the parent or page has a busy/colored background, and verify the panel's `background-color` uses an alpha channel like `rgba(255,255,255,0.2)`.
How well is `backdrop-filter` supported?
All modern browsers support `backdrop-filter`, including Chrome, Edge, Firefox, and Safari. Older Safari requires the `-webkit-backdrop-filter` prefix, so include both for maximum compatibility. For unsupported browsers, the panel will simply appear as a translucent overlay without blur, which is usually an acceptable graceful fallback. Use `@supports (backdrop-filter: blur(1px))` if you need to feature-detect.
Is glassmorphism accessible?
It can be tricky. Translucent text on busy backgrounds often fails WCAG contrast requirements. Boost the panel opacity to 50-70%, add a subtle solid color tint behind text areas, and run final designs through a contrast checker. Also avoid putting critical text directly over high-contrast backgrounds where the blur isn't enough to make foreground text legible.
Does backdrop-filter affect performance?
Yes, especially on mobile and low-end devices. Each blurred element forces the GPU to re-render the area behind it, which is more expensive than a regular blur. Limit glassmorphism to a few key UI elements like sticky headers or modals, avoid animating `backdrop-filter` values, and consider lowering blur radius on smaller viewports via media queries to keep scroll performance smooth.
How do I make glassmorphism look realistic?
Real glass has depth, not just blur. Use a 1px border with a light gradient or `rgba(255,255,255,0.2)` to suggest a refractive edge, add a subtle inner highlight via `box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);`, and keep the panel's background tint slightly cooler or warmer than pure white. A small box-shadow underneath grounds the panel above the page so it doesn't look like a sticker.