Glassmorphism DLS Download Markdown

Design with frosted light, not flat color.

A design language for translucent interfaces: tokens, glass math, components and fallbacks for web, Tailwind and Figma. Everything below is live, built with the same CSS it documents.

Philosophy and core principles

Every surface is a sheet of frosted glass floating above a luminous environment. Hierarchy comes from blur, brightness, rim light and shadow instead of opaque color.

Frosted glass

Surfaces blur and tint what sits behind them.

Depth layers

Elevation is blur plus shadow plus brightness.

Light refraction

Light enters top-left and catches the glass edge.

Legibility first

Scrims and fallbacks keep content readable.

Layer model

TierRoleBlurFill (dark)Z-index
G0 CanvasBackground, spheresnonen/a0
G1 SurfaceNav, sidebars12px8–12%10
G2 RaisedCards, popovers20px12–16%20–40
G3 OverlayModals, sheets32px18–24%50–60
G4 FloatTooltips, toasts, badges8–16px20–28%70–90

Light and dark

Dark mode uses white glass at 8–24%. Light mode needs roughly three times the fill (40–74% white), softer saturation (140–160%), indigo-tinted shadows and dark text. Use the toggle in the header to compare.

Backgrounds, lighting and color tokens

Glass needs something to refract: a base color, a gradient mesh and two to four blurred spheres partly hidden behind content.

Violet#7C4DFF
Cyan#12C8F0
Pink#F0489A
Success#22C583
Warning#F8A21B
Danger#F04545

Translucency tokens

TokenDarkLightUse
--glass-fill-subtlewhite 6%white 40%Quiet panels
--glass-fill-defaultwhite 10%white 52%Cards, nav
--glass-fill-strongwhite 16%white 64%Raised cards
--glass-fill-overlaywhite 22%white 74%Modals
--glass-scrimnavy 35%indigo 8%Text contrast tint

Background recipe

.glass-canvas {
  background-color: var(--canvas-base);
  background-image:
    radial-gradient(60% 50% at 15% 10%, hsla(262 90% 60% / .45), transparent 70%),
    radial-gradient(50% 45% at 85% 20%, hsla(190 95% 55% / .35), transparent 70%),
    radial-gradient(55% 50% at 60% 95%, hsla(330 90% 60% / .35), transparent 70%);
}
.sphere { position: absolute; border-radius: 9999px; filter: blur(60px); opacity: .55; }

The glass effect math

Raise blur before raising opacity. Saturation restores the color that blur averages away.

Clearblur 10px, saturate 150%. Tooltips, chips.
Standardblur 16px, saturate 170%. Cards, nav.
Frostedblur 24px, saturate 180%. Popovers.
Ultra-frostblur 36px, saturate 190%. Modals.

Core primitive with rim light

.glass {
  position: relative; isolation: isolate;
  background: var(--glass-fill-default);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
          backdrop-filter: blur(16px) saturate(170%);
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 hsla(0 0% 100% / .35),          /* specular highlight */
    0 8px 32px -4px hsla(262 70% 8% / .45),        /* colored ambient shadow */
    0 2px 6px hsla(262 70% 8% / .25);              /* contact shadow */
}
.glass::before {                                    /* gradient rim, brightest top-left */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, hsla(0 0% 100% / .55), hsla(0 0% 100% / .12) 35%,
                              hsla(0 0% 100% / .04) 65%, hsla(0 0% 100% / .12));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}

Tailwind

relative isolate rounded-[20px] border border-white/20 bg-white/10
backdrop-blur-[16px] backdrop-saturate-[1.7]
shadow-[0_8px_32px_-4px_hsla(262,70%,8%,.45)]

Typography and visibility

Inter for interface text, Plus Jakarta Sans for headings, JetBrains Mono for code. Body weight is 500, never below 400, never under 12px on glass.

Display48/52 · 700

Heading one36/42 · 700

Heading two28/34 · 650

Heading three22/28 · 600

Body copy sits at weight 500 so thin strokes survive blur.16/24 · 500

Caption and badge text12/16 · 600

Contrast techniques, in order

1. More blur

Diffusion flattens the luminance behind text before you touch opacity.

2. Scrim tint

Add --glass-scrim under text-heavy panels.

3. Weight boost

Add 100 to small text: 400 becomes 500.

4. Soft text shadow

0 1px 2px hsla(240 40% 4% / .35) anchors glyphs.

Interactive components

Try the states: hover, press and tab through them.

Buttons

Idle, hover glow, inset press, focus ring, disabled.

Inputs

Recessed glass with a cyan focus halo.

Tooltips and badges

Compact frosted surfaces with a darker tint.

Saved to your library
BetaPublishedFailed

Layering

Layerz-indexBlur
Surface (nav)1012–16px
Cards2016–20px
Dropdown, popover4020–24px
Modal scrim508px on the page behind
Modal6032–36px
Tooltip8010–12px

Never nest backdrop-filter inside another glass element; use a plain translucent fill instead.

Button CSS

.btn-glass { min-height: 44px; border-radius: 14px; background: var(--glass-fill-default);
  -webkit-backdrop-filter: blur(14px) saturate(170%); backdrop-filter: blur(14px) saturate(170%);
  box-shadow: inset 0 1px 0 hsla(0 0% 100% / .35), 0 4px 20px -2px hsla(262 70% 8% / .35); }
.btn-glass:hover  { background: var(--glass-fill-strong); transform: translateY(-1px);
                    box-shadow: inset 0 1px 0 hsla(0 0% 100% / .45), 0 0 24px hsla(262 90% 62% / .55); }
.btn-glass:active { background: hsla(0 0% 100% / .05); transform: scale(.98);
                    box-shadow: inset 0 2px 8px hsla(240 40% 4% / .45); }
.btn-glass:focus-visible { outline: 2px solid hsl(190 95% 62%); outline-offset: 3px; }

Accessibility and fallbacks

Unsupported browsers get a more opaque surface, never an unreadable see-through one.

.glass { background: hsla(250 30% 16% / .92); }            /* opaque default */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-fill-default); }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: hsl(250 30% 16%); }
}
@media (prefers-reduced-motion: reduce) { .sphere { animation: none; } }

WCAG 2.1 guidance

CriterionRequirementGlass guidance
1.4.3 Contrast4.5:1 text, 3:1 largeMeasure against the worst-case backdrop pixel, not the average
1.4.11 Non-text contrast3:1 for component edgesRim light alone usually fails; add a border or focus ring
1.4.1 Use of colorNot color alonePair glow and tint with icons or text
2.4.7 Focus visibleVisible keyboard focus2px cyan ring with offset
2.2.2 Pause, stop, hideMoving content can stopStop sphere drift for reduced motion

Performance

Budget

About 3–4 blurred layers per mobile viewport. Animate only transform and opacity.

Lists

One glass container behind a list, plain translucent rows inside. Offer a manual Reduce transparency toggle.