HandyBench

Glassmorphism CSS Generator

Design a frosted-glass UI card and copy the CSS.

Glass card
background: rgba(255, 255, 255, 0.2);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.3);

How to use the Glassmorphism CSS Generator

  1. 1 Adjust blur, background transparency and tint color over the colorful backdrop preview.
  2. 2 Set the border opacity and corner radius to complete the glass look.
  3. 3 Copy the generated CSS (background, backdrop-filter and border) into your stylesheet.

The five declarations that make glass

A frosted-glass card is a stack of small effects, and the tool writes each one explicitly. Defaults are an 8 px blur, a white tint at 0.2 opacity, a border at 0.3 opacity and a 16 px radius.

background: rgba(255, 255, 255, 0.2);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.3);
  • backdrop-filter blurs whatever is painted behind the element. It is different from filter, which would blur the card's own text.
  • The semi-transparent background is what lets the blurred scene show through. Only the tint color is adjustable; the border is always white.
  • The thin light border mimics a glass edge catching light, and the fixed soft shadow lifts the card off the page.

Browser support and fallbacks

The unprefixed property is supported in current Chrome, Edge, Firefox and Safari, and Safari needed the -webkit- prefix for years, which is why the tool emits both lines. Older browsers ignore the property and show only the translucent tint, so the text may sit directly on a busy image. Wrap the effect in a feature query and give a more opaque fallback.

.card { background: rgba(30, 30, 40, 0.85); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
  }
}

Worked example: legibility

Take white text on the default card over the preview gradient. A 0.2 white tint lifts the pixels beneath it only slightly. Assuming the blur leaves the local color roughly unchanged, the text contrast against what is underneath is approximately:

Backdrop colorUnder the 0.2 white tintWhite text contrast
#f472b6 (pink)#f68ec52.19 : 1
#6366f1 (indigo)#8285f43.18 : 1
#22d3ee (cyan)#4edcf11.64 : 1

All of these are below the 4.5 : 1 WCAG minimum for normal text. A pale tint over a bright backdrop is the usual failure of this style, so use a dark tint, or place text over a darker region, and verify it in the contrast checker.

Performance and layout traps

  • Cost scales with area and radius. The browser must re-blur the pixels behind the card whenever they change, so large glass panels over video or animation are expensive on weak GPUs.
  • A blur of 0 is useless. With no blur, you only have a see-through card.
  • Ancestors can break it. A parent with its own filter, opacity below 1, mask or will-change can limit what the card sees behind it, which shows up as a flat, unblurred panel.
  • Plain backgrounds hide the effect. With nothing busy behind it, the card looks like a plain translucent box. Try a photo or the gradient generator output as the backdrop.

Examples

  • ▸ A translucent frosted card over a photo or gradient hero background.
  • ▸ A glass-style navigation bar that blurs the content scrolling behind it.

Frequently asked questions

What CSS property creates the glassmorphism effect?

The key property is backdrop-filter: blur(), which blurs whatever is behind an element, combined with a semi-transparent background color and a subtle light border to sell the "frosted glass" look.

Does backdrop-filter work in every browser?

It is supported in all current major browsers (Chrome, Edge, Firefox and Safari), though very old browser versions may ignore it and simply show the semi-transparent background without the blur.

Why does my glass card look invisible or flat?

Glassmorphism needs something visually busy behind it — a photo, gradient or colorful background — to blur. Over a plain solid background, the blur has nothing to show, so the effect can look flat.

What makes a glassmorphism design feel "right"?

Low background opacity (around 10–20%), a generous blur, a thin semi-transparent white border, and soft rounded corners together create the light, layered depth the style is known for.

Is glassmorphism accessible?

Not automatically. Text sits over a changing background, so contrast can fail where the backdrop is bright. Use a darker tint or higher background opacity behind text, and check the result with a contrast tool.