How to Create Glassmorphism Effects in CSS (2026 Guide)
September 28, 2026 | 9 min read | CSS
By Syed · Frontend Engineer & Creator of UITweak
Glassmorphism, the frosted-glass look, has survived every design trend cycle since Apple popularized it. You'll find it in iOS widgets, Windows 11 panels, macOS menus, Linear-style dashboards, and countless landing pages. It works because it adds depth without heavy shadows, and it keeps background context visible while pushing it out of focus.
The good news: the effect needs only a handful of CSS properties. The bad news: getting it to look right, especially in Safari, has a few traps. This guide gives you the complete recipe, the browser gotchas, the Tailwind approach, and three practical examples you can copy into your project today.
What Is Glassmorphism, Exactly?
Glassmorphism mimics a pane of frosted glass placed over content. It has four visual signatures:
- Translucency: you can see content behind the panel, but blurred.
- Blur: the background behind the panel is out of focus.
- A subtle edge: a light, low-opacity border defines the glass boundary.
- Depth: a soft shadow lifts the panel off the background.
One critical thing beginners miss: glassmorphism only works against colorful, complex backgrounds.Against a flat white page it's invisible. Against a solid dark background it just looks like a semi-opaque box. The frosted effect only reads when there's real visual texture behind the glass. Every example in this guide sits on a gradient for exactly this reason.
The Core CSS Recipe: Three Ingredients
The entire effect comes down to three properties on the glass element:
1. A semi-transparent background
This is the “tint” of the glass. Use rgba() or the modern color-mix() so the background color itself is translucent:
background: rgba(255, 255, 255, 0.12);For dark glass, tint toward black instead:
background: rgba(15, 15, 25, 0.45);2. backdrop-filter: blur()
This is the magic. Note the prefix: it's backdrop-filter, not filter. filter: blur() blurs the element itself; backdrop-filter: blur() blurs everything behind the element:
backdrop-filter: blur(16px) saturate(140%);
-webkit-backdrop-filter: blur(16px) saturate(140%);The saturate(140%) is a pro touch, blurring washes colors out, and a saturation boost restores the vibrancy. Always include the -webkit- prefixed line for Safari (more on that below).
3. A subtle light border
A 1px border at low opacity creates the “edge of the glass” highlight:
border: 1px solid rgba(255, 255, 255, 0.25);Put together, with rounded corners and a soft shadow, the complete recipe looks like this:
.glass-card {
background: rgba(255, 255, 255, 0.12);
backdrop-filter: blur(16px) saturate(140%);
-webkit-backdrop-filter: blur(16px) saturate(140%);
border: 1px solid rgba(255, 255, 255, 0.25);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
padding: 2rem;
}That's it. Everything else is tuning the values to taste.
Example 1: Glass Card Over a Gradient
Here's a complete, copy-paste example, a pricing-style card floating over a vivid gradient background:
<div class="scene">
<div class="glass-card">
<h2>Pro Plan</h2>
<p class="price">$12<span>/mo</span></p>
<p>Everything you need to ship faster.</p>
<button>Get started</button>
</div>
</div>.scene {
min-height: 100vh;
display: grid;
place-items: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}
.glass-card {
background: rgba(255, 255, 255, 0.12);
backdrop-filter: blur(16px) saturate(140%);
-webkit-backdrop-filter: blur(16px) saturate(140%);
border: 1px solid rgba(255, 255, 255, 0.25);
border-radius: 20px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
padding: 2.5rem;
color: #fff;
max-width: 320px;
text-align: center;
}
.glass-card button {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
padding: 0.75rem 2rem;
border-radius: 999px;
cursor: pointer;
font-weight: 600;
}
.glass-card button:hover {
background: rgba(255, 255, 255, 0.32);
}Notice the button is itself a mini glass element, nested glassmorphism looks great as long as you keep the blur values consistent.
Safari Gotchas (Read This Before Shipping)
Most hand-written glassmorphism CSS breaks in Safari. Here's the checklist:
Always include -webkit-backdrop-filter. Safari still needs the prefixed property. Write both lines, prefixed first, every time:
-webkit-backdrop-filter: blur(16px) saturate(140%);
backdrop-filter: blur(16px) saturate(140%);Provide a fallback with @supports. If backdrop-filterisn't supported at all, your translucent background alone will look washed out. Detect support and upgrade gracefully:
.glass-card {
/* Fallback: solid-ish translucent panel */
background: rgba(30, 30, 45, 0.75);
border: 1px solid rgba(255, 255, 255, 0.15);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
.glass-card {
background: rgba(255, 255, 255, 0.12);
-webkit-backdrop-filter: blur(16px) saturate(140%);
backdrop-filter: blur(16px) saturate(140%);
}
}Watch out for clipping bugs. In Safari, combining backdrop-filter with overflow: hidden and border-radius on the same element has historically caused the blur to paint incorrectly. If your glass panel looks wrong in Safari, try moving the border-radius/overflow to a wrapper element.
Test on real iOS. The iOS Safari renderer handles backdrop-filterdifferently from desktop, particularly with fixed-position elements. A frosted navbar that looks perfect in Chrome DevTools' device mode can still glitch on a real iPhone.
Performance matters. backdrop-filterforces the browser to repaint the backdrop on every frame it changes. Keep blur radii reasonable (8–20px is the sweet spot), avoid covering the entire viewport with glass on mobile, and don't animate the blur value itself.
Glassmorphism in Tailwind CSS
Tailwind ships backdrop utilities out of the box, so the recipe translates directly:
<div class="backdrop-blur-xl bg-white/10 border border-white/25 rounded-2xl shadow-xl p-8 text-white">
<h2 class="text-2xl font-bold">Pro Plan</h2>
<p>Everything you need to ship faster.</p>
</div>For values Tailwind doesn't include, use arbitrary values, note the underscores stand in for spaces:
<div class="backdrop-blur-[18px] bg-white/[0.12] border border-white/25 rounded-[20px]">
<!-- content -->
</div>And for the Safari prefix, Tailwind's backdrop-blur-* utilities already emit -webkit-backdrop-filterin the compiled CSS, so you're covered.
Example 2: Frosted Navbar
A frosted sticky navbar is the most common production use of glassmorphism. It needs to work in both light and dark mode:
<header class="fixed top-0 inset-x-0 z-50 backdrop-blur-lg bg-white/70 border-b border-black/5 dark:bg-black/40 dark:border-white/10">
<nav class="max-w-6xl mx-auto flex items-center justify-between px-6 py-4">
<span class="font-bold text-lg">Acme</span>
<div class="flex gap-6 text-sm">
<a href="#">Features</a>
<a href="#">Pricing</a>
<a href="#">Docs</a>
</div>
<button class="bg-black text-white dark:bg-white dark:text-black px-4 py-2 rounded-full text-sm font-medium">
Sign in
</button>
</nav>
</header>The trick here: higher background opacity (bg-white/70) than a card, because a navbar sits over scrolling content and needs to stay legible.
Example 3: Dark Glass Modal
Dark glass looks premium on colorful backgrounds. This modal pattern works for dialogs, login forms, and cookie banners:
.glass-dark {
background: rgba(12, 12, 22, 0.5);
-webkit-backdrop-filter: blur(20px) saturate(160%);
backdrop-filter: blur(20px) saturate(160%);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 18px;
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
color: #f4f4f5;
}
/* Top highlight: sells the "glass" illusion */
.glass-dark::before {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1px;
background: linear-gradient(135deg, rgba(255,255,255,0.35), transparent 40%);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}That ::beforeoverlay paints a light gradient only along the top-left edge, it's the detail that separates “flat translucent box” from “actual glass.”
Accessibility Tips
- Check text contrast against the blurred average, not the panel color. White text over a bright blurred photo can fail WCAG even though it “looks fine” at a glance. Run your palette through a contrast checker with a screenshot of the real background.
- Don't rely on blur to hide sensitive content. Blurred text behind glass can sometimes be reconstructed, never use glassmorphism to obscure passwords, personal data, or anything confidential.
- Respect
prefers-reduced-motionif you animate glass panels in or out.
FAQ
Does backdrop-filter work in all browsers?
All modern browsers support it. Safari requires the -webkit- prefix, and you should always provide an @supports fallback for older browsers.
Why does my glass effect look invisible?
Almost always because the background behind it is too flat. Glassmorphism needs colorful, textured content behind the panel, gradients, photos, or busy UI. Test your glass against at least three different backgrounds.
Why is my page slow after adding glassmorphism?
Large backdrop-filter areas are GPU-expensive, especially on mobile. Reduce the blur radius, shrink the glass areas, and avoid animating anything that forces the backdrop to repaint.
Can I animate backdrop-filter?
Technically yes, but it's one of the most expensive properties to animate. Animate opacity or transform on the panel instead, and keep the blur static.
What's the difference between glassmorphism and neumorphism?
Glassmorphism is translucent + blurred over busy, colorful backgrounds. Neumorphism is soft, extruded dual-shadows on flat, monochrome backgrounds. They solve opposite problems, pick based on your background. For Apple's newer take on the same idea (specular highlights, refraction), see our liquid glass CSS guide.
How do I make glassmorphism work in Tailwind?
Use backdrop-blur-*, bg-white/10-style opacity colors, and border-white/20-style borders. Tailwind emits the -webkit- prefix for you.
Skip the Guesswork
Dialing in blur radius, tint opacity, saturation, and border values by hand means a lot of tab-switching between your editor and the browser, and you still won't see how it looks against realistic backgrounds until it's in production. The free Glassmorphism CSS Generator gives you sliders for every value, a live preview over five realistic backgrounds, automatic -webkit- prefixes for Safari, and one-click exports for CSS, Tailwind, React, and Vue. Build it visually, copy production-ready code.