CSS Glass Generator
Generate CSS glassmorphism effects with live preview and code export
このツールについて
Design stunning glassmorphism UI cards entirely in CSS. Adjust backdrop blur, background opacity, border opacity, border radius, and shadow strength using intuitive sliders. Choose from three gradient background presets — purple-blue, sunset orange-pink, and ocean teal-green — to see exactly how your glass effect looks against colourful content. The live preview shows a realistic glass card floating over the chosen background. Copy the generated CSS including backdrop-filter, background, border, border-radius, and box-shadow with one click.
使い方
- 1 Choose a background scene preset (purple-blue, sunset, or ocean) from the selector.
- 2 Drag the Blur slider to set the backdrop-filter blur amount (0–40px).
- 3 Adjust Background Opacity to control how translucent the panel is.
- 4 Set Border Opacity for the glass edge highlight.
- 5 Change Border Radius to round the corners.
- 6 Increase Shadow Strength to add depth with a soft box-shadow.
- 7 Click 'Copy CSS' to copy the generated CSS to your clipboard.
What makes glass look like glass in CSS
Glassmorphism is the frosted-panel look you see in modern operating systems and app dashboards: a translucent card that blurs whatever sits behind it, edged with a faint highlight and lifted off the page by a soft shadow. It is built from four CSS properties working together, and this generator exposes each one as a slider so you can feel how they interact. The output is a complete, ready-to-paste rule:
backdrop-filter: blur(...)— the defining ingredient. It blurs the pixels behind the element, not the element itself. This is what frosts the glass.background: rgba(255,255,255,...)— a thin white veil. The alpha value is your tint: too low and the glass vanishes, too high and it turns into an opaque card.border: 1px solid rgba(255,255,255,...)— a barely-there white edge that catches the light and separates the panel from the background.box-shadow: 0 8px 32px 0 rgba(0,0,0,...)— a large, soft, downward shadow that makes the glass appear to float.
The exact CSS this tool produces
With the default sliders the generator emits the following, and the live preview applies the identical values so what you see is what you copy:
| Slider | Default | CSS it writes |
|---|---|---|
| Blur | 12px | backdrop-filter: blur(12px) |
| Background Opacity | 0.15 | background: rgba(255,255,255,0.15) |
| Border Opacity | 0.30 | border: 1px solid rgba(255,255,255,0.30) |
| Border Radius | 16px | border-radius: 16px |
| Shadow Strength | 0.25 | box-shadow: 0 8px 32px 0 rgba(0,0,0,0.25) |
The opacity sliders run from 0 to 100 in the interface but are divided by 100 to produce the rgba() alpha — so "15" on the slider becomes 0.15 in the code. The generator always writes both -webkit-backdrop-filter and the standard backdrop-filter so the effect survives on Safari, which still wants the prefixed property.
A worked example: a readable hero card
Imagine a colourful photo background with white text on top. Start from the defaults, then nudge the background opacity up to about 0.25 — text legibility is the usual reason to add tint, because pure 0.15 glass over a busy image can leave letters hard to read. Drop the blur to around 8px so the background stays recognisable rather than becoming an abstract smear, and raise the shadow to 0.35 for a stronger float. The result is a panel that reads cleanly while still letting the image breathe through it. Copy the rule, give your element class="glass-card", and you are done.
Why your glass might look invisible
The single most common complaint is "I pasted the CSS and nothing happened." Glassmorphism has a hard requirement: there must be something colourful or detailed directly behind the element. Blur and transparency have nothing to act on over a flat white page, so the effect collapses to a faintly grey rectangle. That is exactly why this tool ships three gradient background presets — purple-blue, sunset, and ocean — so the preview always sits over content worth blurring. When you move the CSS into your own project, make sure the glass overlaps an image, a gradient, or other page content.
Practical tips
- Keep blur moderate. Past roughly 20px the background dissolves into mush and the "glass" reads as plain frosted plastic. 8–16px is the sweet spot.
- Mind contrast for accessibility. Translucent panels can drop text contrast below readable levels. If you layer text on glass, tint the background higher or add a subtle text shadow.
- Performance has a cost.
backdrop-filterforces the browser to re-blur on every repaint. Avoid stacking dozens of glass panels or animating them on low-powered devices. - Tint with a colour, not just white. The generator uses white, but you can swap the
rgba()red/green/blue values in the copied code to match a brand colour for tinted glass.
Browser support and the fallback
The backdrop-filter property works in current Chrome, Edge, Firefox, and Safari (the last via the -webkit- prefix this tool already includes). On a browser that does not support it, the blur is simply ignored — the element falls back to its semi-transparent background and border, which still looks acceptable. Everything here runs entirely in your browser: the CSS is assembled on your device and copied to your clipboard, with no data sent anywhere.