Translucent panels that blur whatever sits behind them have become a familiar part of interface design, from operating system menus to landing page hero cards. The look is usually called glassmorphism, and on the web it is built almost entirely from one CSS property. Getting it to look good is easy; getting it to stay readable, work in every browser and not slow the page down takes a little more care.
This guide explains how the frosted glass effect works, what each setting contributes, how to write it with sensible fallbacks, and when not to use it at all.
The ingredients of a glass panel
A convincing glass card combines four things:
- A translucent fill: a background colour with low opacity, typically white at 10-30% on colourful backgrounds or a dark tint for dark themes.
- A backdrop blur:
backdrop-filter: blur()blurs everything behind the element, not the element's own content. This is the frosted part. - A subtle border: a 1px semi-transparent light border that catches the "edge" of the glass.
- Optionally, a soft shadow that lifts the card off the background.
The distinction between filter and backdrop-filter is key. filter: blur(10px) would blur the card itself, including its text. backdrop-filter leaves the card's content sharp and applies the effect to the pixels showing through it.
A complete example
.glass {
background: rgba(255, 255, 255, 0.2);
-webkit-backdrop-filter: blur(16px) saturate(180%);
backdrop-filter: blur(16px) saturate(180%);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.18);
}
Each value has a job:
blur(16px)sets how frosted the glass is. Around 4-8px keeps shapes behind recognisable; 20px and up turns them into soft washes of colour.saturate(180%)boosts the colours that show through, which stops the blurred background looking grey and muddy. Values between 100% (no change) and about 200% are typical.- The background alpha controls how much tint you add. More opacity means better text contrast but less "glass".
- The border at around 20-40% opacity defines the edge, which matters on busy backgrounds where the blur alone does not separate the card.
The -webkit- prefixed line is included for Safari, which has long required the prefix for this property.
The effect needs something behind it
Glass on a flat white page looks like a slightly grey box. The effect only works when there is colour and shape behind the panel: a photograph, a gradient, or blurred shapes. If your page background is plain, add some colour first. A CSS gradient generator is a quick way to create a multi-colour backdrop, and radial gradients placed at different positions make good "blobs".
Design one with the generator
The Glassmorphism Generator shows the card over several backgrounds while you adjust it.
- Open the Glassmorphism Generator. Start from a preset if you like: Frosted, Clear, Heavy or Dark glass.
- Adjust Blur (0-40px), Transparency (fill opacity) (0-100%), Saturation (100-250%), Border opacity and Corner radius.
- Pick a Glass tint colour. White suits colourful or dark backgrounds; a dark navy tint gives a smoky dark-mode panel.
- Turn Shadow on or off.
- Switch between the preview backgrounds (Aurora, Sunset, Ocean, Blobs and Dark) to see how the card behaves over different content.
- Copy the generated
.glassCSS, which includes both the prefixed and standardbackdrop-filterlines.
Browser support and fallbacks
backdrop-filter works in current versions of the major browsers. Where it is not supported, or turned off, the browser simply ignores it and shows the translucent fill without blur. That can leave text sitting on an unblurred, busy background, so provide a more opaque fallback with a feature query:
.glass {
background: rgba(255, 255, 255, 0.85);
border-radius: 16px;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
.glass {
background: rgba(255, 255, 255, 0.2);
-webkit-backdrop-filter: blur(16px) saturate(180%);
backdrop-filter: blur(16px) saturate(180%);
}
}
Now browsers without support get a solid, readable panel, and the rest get the glass.
Keeping glass readable
Glassmorphism fails accessibility reviews more often than most styles, because the background behind the text changes from place to place.
Check contrast at the worst spot
WCAG requires 4.5:1 contrast for normal text. With glass, the "background" is the blurred content plus your tint, so check the lightest (or darkest) area behind the text, not an average. The colour contrast checker gives the ratio once you sample the actual rendered colour, and the guide to WCAG contrast ratios explains the thresholds.
Increase blur or tint for text-heavy cards
More blur flattens detail behind the text; more tint opacity pushes the background towards a single colour. For cards with paragraphs, aim for a noticeably opaque panel. Save the very clear glass for decorative elements or short labels.
Add a subtle text shadow if needed
A faint shadow behind light text can help on varied backgrounds. Keep it soft; the text shadow generator helps you tune it.
Respect user preferences
Some operating systems offer a "reduce transparency" setting, and a matching prefers-reduced-transparency media query exists in the CSS specifications, but browser support is still limited. Check current support before relying on it, and make sure your default design is readable without it.
Performance considerations
backdrop-filter has to re-render the blurred region whenever anything behind it changes. A few static cards are fine. Problems appear when:
- a large glass element covers most of the viewport, such as a full-screen overlay;
- glass sits over video or animated content, forcing a re-blur every frame;
- many glass elements stack or scroll over each other on low-powered phones.
If scrolling feels janky, reduce the blur radius, shrink the glass area, or replace blur with a solid semi-transparent colour on small screens.
Related styles
Glassmorphism is often compared with neumorphism, the soft, extruded look made from paired light and dark shadows on a flat background. They solve different problems: glass works over rich backgrounds, neumorphism needs a plain one. The neumorphism generator builds the latter, and the box shadow generator gives finer control over the shadow on a glass card.
Frequently asked questions
What is glassmorphism in CSS?
It is a style where panels look like frosted glass: a translucent fill, a backdrop-filter blur of the content behind, a thin light border and often a soft shadow.
Why is backdrop-filter not working?
Common causes are a fully opaque background on the element (nothing shows through), nothing colourful behind it, missing the -webkit- prefix for Safari, or an unsupported browser.
What is the difference between filter and backdrop-filter?
filter applies effects to the element and its content. backdrop-filter applies them to whatever is visible behind the element, leaving the element's own text sharp.
Does glassmorphism hurt performance?
Small, static glass elements are usually fine. Large blurred areas, stacked glass layers or glass over animation can reduce frame rates, especially on mobile devices.
Is glassmorphism accessible?
It can be, if text keeps sufficient contrast over every part of the background. Use enough tint and blur, test the worst case, and provide an opaque fallback.