SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/glassmorphism

7 CSS Glassmorphism

6 Pure CSS1 with JSPublished 2026-10-05Free · no sign-up

Seven frosted glass components: a balance card over coloured shapes, a sign-in form, a now-playing music widget, a weather card on a sky background, a modal whose backdrop blurs the page, a payment card and a notification on a light wallpaper.

01. Frosted Glass Card

GlassmorphismCard

The core glass recipe on a card: a translucent white fill, backdrop-filter blur, a thin light border and rounded corners over colourful shapes. A dark tint inside the glass keeps white text readable even over the brightest part of the background.

View code
<div class="gls1"><span class="a" aria-hidden="true"></span><span class="b" aria-hidden="true"></span><article><p class="k">Balance</p><p class="v">$4,820.50</p><p class="d">Updated just now</p></article></div>
.gls1 { position: relative; display: grid; place-items: center; width: 300px; max-width: 100%; height: 240px; overflow: hidden; border-radius: 18px; background: #0b1020; font-family: Inter, system-ui, sans-serif; }
.gls1 span { position: absolute; border-radius: 50%; }
.gls1 .a { width: 150px; height: 150px; top: 10px; left: 20px; background: #f97316; } .gls1 .b { width: 170px; height: 170px; right: 0; bottom: -20px; background: #8b5cf6; }
.gls1 article { position: relative; width: 220px; padding: 20px; box-sizing: border-box; border: 1px solid rgba(255,255,255,.3); border-radius: 18px; background: rgba(15,23,42,.35); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); color: #fff; }
.gls1 p { margin: 0; } .gls1 .k { font-size: 13px; color: #e2e8f0; } .gls1 .v { margin: 4px 0; font-size: 28px; font-weight: 800; } .gls1 .d { color: #e2e8f0; font-size: 12px; }

02. Glass Sign-in Form

GlassmorphismForm

A sign-in form on a glass panel over a photo-like gradient, with fields that are slightly more opaque than the panel so they stand out as places to type. Labels sit above the fields, and focus rings are solid white for visibility.

View code
<div class="gls2"><form><h3>Welcome back</h3><label>Email<input type="email" autocomplete="email"></label><label>Password<input type="password" autocomplete="current-password"></label><button type="button">Sign in</button></form></div>
.gls2 { display: grid; place-items: center; width: 320px; max-width: 100%; padding: 24px 16px; box-sizing: border-box; border-radius: 18px; background: radial-gradient(circle at 20% 20%, #fb7185, transparent 45%), radial-gradient(circle at 80% 70%, #22d3ee, transparent 45%), #312e81; font: 14px Inter, system-ui, sans-serif; }
.gls2 form { display: grid; gap: 10px; width: 100%; padding: 20px; box-sizing: border-box; border: 1px solid rgba(255,255,255,.35); border-radius: 18px; background: rgba(255,255,255,.14); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; }
.gls2 h3 { margin: 0 0 4px; }
.gls2 label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.gls2 input { min-width: 0; padding: 10px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: rgba(15,23,42,.35); color: #fff; font: inherit; }
.gls2 button { margin-top: 4px; padding: 11px; border: 0; border-radius: 10px; background: #fff; color: #312e81; font: 700 14px Inter, system-ui, sans-serif; cursor: pointer; }
.gls2 :focus-visible, .gls2 input:focus { outline: 2px solid #fff; outline-offset: 2px; }

03. Glass Music Player

GlassmorphismPlayer

A now-playing widget on glass: album art, track title, a progress bar and controls, all on a frosted panel over the album's own colours. The controls are labelled buttons, and the progress is a native progress element.

View code
<div class="gls3"><section aria-label="Now playing"><div class="art" aria-hidden="true"></div><div class="tx"><b>Tidal Hours</b><span>Marine Room</span></div><progress max="100" value="42" aria-label="Track progress">42%</progress><div class="ctl"><button aria-label="Previous">⏮</button><button aria-label="Pause" class="pl">⏸</button><button aria-label="Next">⏭</button></div></section></div>
.gls3 { display: grid; place-items: center; width: 300px; max-width: 100%; padding: 20px; box-sizing: border-box; border-radius: 18px; background: linear-gradient(135deg, #0ea5e9, #6366f1 50%, #db2777); font: 14px Inter, system-ui, sans-serif; }
.gls3 section { display: grid; grid-template-columns: 56px 1fr; gap: 10px 12px; width: 100%; padding: 14px; box-sizing: border-box; border: 1px solid rgba(255,255,255,.35); border-radius: 18px; background: rgba(15,23,42,.3); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; }
.gls3 .art { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, #fde68a, #f472b6); }
.gls3 .tx { display: grid; align-content: center; } .gls3 .tx span { color: #e2e8f0; font-size: 13px; }
.gls3 progress { grid-column: 1 / -1; width: 100%; height: 4px; appearance: none; border: 0; border-radius: 2px; background: rgba(255,255,255,.3); }
.gls3 progress::-webkit-progress-bar { background: rgba(255,255,255,.3); } .gls3 progress::-webkit-progress-value { background: #fff; } .gls3 progress::-moz-progress-bar { background: #fff; }
.gls3 .ctl { grid-column: 1 / -1; display: flex; justify-content: center; gap: 14px; }
.gls3 button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 16px; cursor: pointer; }
.gls3 .pl { background: #fff; color: #312e81; }
.gls3 button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

04. Glass Weather Widget

GlassmorphismWidget

A weather card on glass over a sky gradient, with the temperature large, the condition in words and a small three-day forecast. The light glass tint and dark text suit bright backgrounds better than white text.

View code
<div class="gls4"><article><p class="c">Porto</p><p class="t">19°</p><p class="w">Partly cloudy</p><ul><li><b>Tue</b> 21°</li><li><b>Wed</b> 18°</li><li><b>Thu</b> 22°</li></ul></article></div>
.gls4 { display: grid; place-items: center; width: 300px; max-width: 100%; padding: 22px; box-sizing: border-box; border-radius: 18px; background: radial-gradient(circle at 75% 25%, #fde047 0 14%, transparent 15%), linear-gradient(#7dd3fc, #e0f2fe); font: 14px Inter, system-ui, sans-serif; }
.gls4 article { width: 100%; padding: 18px; box-sizing: border-box; border: 1px solid rgba(255,255,255,.7); border-radius: 18px; background: rgba(255,255,255,.45); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: #0c4a6e; }
.gls4 p { margin: 0; } .gls4 .c { font-weight: 700; } .gls4 .t { font-size: 48px; font-weight: 300; line-height: 1.1; } .gls4 .w { margin-bottom: 12px; }
.gls4 ul { display: flex; justify-content: space-between; margin: 0; padding: 10px 0 0; list-style: none; border-top: 1px solid rgba(12,74,110,.2); font-size: 13px; }

05. Glass Modal over the Page

GlassmorphismDialog

A dialog whose panel is glass and whose backdrop blurs the page behind it. Both use backdrop-filter, and the dialog element handles focus trapping and Escape, so the effect is purely visual.

View code
<div class="gls5"><span class="bg" aria-hidden="true"></span><button class="open">Share project</button><dialog aria-labelledby="gls5h"><h3 id="gls5h">Share project</h3><p>Anyone with the link can view.</p><button class="x">Done</button></dialog></div>
.gls5 { position: relative; display: grid; place-items: center; width: 300px; max-width: 100%; height: 220px; overflow: hidden; border-radius: 18px; font: 14px Inter, system-ui, sans-serif; }
.gls5 .bg { position: absolute; inset: 0; background: radial-gradient(circle at 30% 30%, #f59e0b, transparent 40%), radial-gradient(circle at 70% 70%, #ec4899, transparent 45%), #1e1b4b; }
.gls5 .open { position: relative; padding: 10px 16px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: rgba(255,255,255,.18); color: #fff; font: 600 14px Inter, system-ui, sans-serif; cursor: pointer; }
.gls5 dialog { width: min(260px, 90vw); padding: 20px; border: 1px solid rgba(255,255,255,.35); border-radius: 18px; background: rgba(30,27,75,.45); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); color: #fff; }
.gls5 dialog::backdrop { background: rgba(15,23,42,.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gls5 h3 { margin: 0 0 6px; } .gls5 p { margin: 0 0 14px; color: #e2e8f0; }
.gls5 .x { padding: 8px 14px; border: 0; border-radius: 8px; background: #fff; color: #1e1b4b; font: 700 14px Inter, system-ui, sans-serif; cursor: pointer; }
.gls5 button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
var d = document.querySelector('.gls5 dialog');
document.querySelector('.gls5 .open').onclick = function () { d.showModal(); };
d.querySelector('.x').onclick = function () { d.close(); };

06. Glass Payment Card

GlassmorphismCard

A payment card mock-up made of glass over colourful blobs, showing only the last four digits as real account pages should. The card proportions come from aspect-ratio, and the text sits on a darkened tint for contrast.

View code
<div class="gls6"><span class="a" aria-hidden="true"></span><span class="b" aria-hidden="true"></span><div class="cc" role="img" aria-label="Card ending 7710, expires 09/29"><span class="chip"></span><span class="n">•••• 7710</span><span class="x">09/29</span></div></div>
.gls6 { position: relative; display: grid; place-items: center; width: 320px; max-width: 100%; height: 220px; overflow: hidden; border-radius: 18px; background: #0b1020; }
.gls6 .a, .gls6 .b { position: absolute; border-radius: 50%; } .gls6 .a { width: 130px; height: 130px; left: 30px; top: 20px; background: #22c55e; } .gls6 .b { width: 150px; height: 150px; right: 20px; bottom: 0; background: #0ea5e9; }
.gls6 .cc { position: relative; display: grid; grid-template-rows: 1fr auto; grid-template-columns: 1fr auto; width: 250px; max-width: 90%; aspect-ratio: 85.6 / 54; padding: 18px; box-sizing: border-box; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; background: rgba(15,23,42,.3); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; font: 600 15px "JetBrains Mono", ui-monospace, monospace; }
.gls6 .chip { grid-column: 1 / -1; width: 36px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, #fde68a, #ca8a04); }
.gls6 .x { font-size: 13px; }

07. Glass Notification

GlassmorphismNotification

An iOS-style notification on light glass: app icon, title, message and time, floating over a wallpaper. It is a status region in this demo; light glass with dark text suits bright wallpapers.

View code
<div class="gls7"><div class="n" role="status"><span class="ic" aria-hidden="true">✉</span><div><b>Mail</b><p>Ana: Photos from Saturday are ready.</p></div><time datetime="2026-10-05T09:12">now</time></div></div>
.gls7 { display: grid; align-items: start; width: 320px; max-width: 100%; height: 200px; padding: 16px; box-sizing: border-box; border-radius: 22px; background: linear-gradient(160deg, #fbcfe8, #c4b5fd 50%, #93c5fd); font: 13px Inter, system-ui, sans-serif; }
.gls7 .n { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid rgba(255,255,255,.6); border-radius: 18px; background: rgba(255,255,255,.55); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); color: #1f2937; }
.gls7 .ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #2563eb; color: #fff; }
.gls7 p { margin: 2px 0 0; } .gls7 time { color: #4b5563; font-size: 12px; }

About these CSS Glassmorphism

The glass recipe

A translucent fill, backdrop-filter: blur(), a thin light border and rounded corners. The background behind must be colourful for the effect to show.

Tint for readability

Add enough tint to the glass that text passes contrast over the lightest part of the background. Dark tint with white text, or light tint with dark text, never clear glass.

Fields need more opacity

Inputs on glass should be a little more opaque than the panel, so they read as places to type rather than part of the decoration.

Blur has a cost

Large blurred areas are expensive on low-end phones. Use glass for a few panels, not every element on the page.

Frequently asked questions

Is backdrop-filter supported?

Yes, in all current major browsers, including Safari with the -webkit- prefix.

What is the difference from liquid glass?

Liquid glass adds stronger highlights, inner glows and depth; see the liquid glass collection.

Does glass work on white backgrounds?

Barely; it needs colour or imagery behind it to show the blur.