Skip to content
IndexRequest a UIAboutContact

Glass Card Edge Highlight

A frosted card whose border catches light from a chosen angle, with angle and blur controls.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Close-up UI render of a frosted glass card floating over soft blurred magenta, blue and orange shapes, the card's thin border brightest along the top left edge and fading to almost nothing at the bottom right as if lit from above left, a faint inner highlight along the top, soft shadow below, a title and two lines of text inside, light theme, premium style. Negative: heavy outlines, flat colour card, noisy backgrounds, text errors. Reduced motion: still image.

About this pattern

Definition

Real glass has brighter edges where light hits its bevel. A frosted card feels more physical when the border is a gradient that is bright on the side facing the light and faint on the opposite side. The gradient border is drawn with a masked pseudo-element, so the card stays translucent inside.

Purpose & UX principles

  • Fill the card with a translucent white and a backdrop blur.
  • Add a ::before with a linear or conic gradient, then mask out its centre with mask-composite so only a one to two pixel ring shows.
  • Rotate the gradient angle to move the highlight; keep light direction consistent across cards.
  • Add a faint inner top highlight and a soft shadow underneath.

Interaction states

  • An Angle slider, a Blur slider and a background choice.

Motion specification

  • Updates are immediate.
  • Reduced motion: nothing animates.

Responsive behaviour

  • Backdrop blur is expensive; limit the number of glass cards on one screen.
  • Check text contrast against the busiest part of the background.

Code

HTML
<div class="bx"><div class="st" id="st"><i class="b1"></i><i class="b2"></i><i class="b3"></i><div class="gc"><b>Glass card</b><span>Edge light from the top left.</span></div></div><div class="two"><label class="rw">Light angle <b id="av">315°</b><input id="as" type="range" min="0" max="360" value="315"></label><label class="rw">Blur <b id="bv">14px</b><input id="bs" type="range" min="0" max="30" value="14"></label></div></div>

Related patterns

Frosted Glass & Acrylic

↗
Frosted Glass & AcrylicSurfaces & Objects

Liquid Glass Button

↗
Liquid Glass ButtonGlass & Tactile

Glass Blur Depth

↗
Glass Blur DepthGlass & Tactile