Glass Pricing Card
A 240 px glass pricing card: a one-pixel violet → cyan gradient rim cut out by a mask on a pseudo-element, a badge, a 35 px price, a checked list and a gradient button, above a glow that breathes over 6 s. Pure CSS, with a mask written for all three engines.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Glassmorphism has 47 effects, including 6 free. Explore the category →
3 usage examples



How it works
A .glass-pricing-card 240 px wide (342 px tall measured in Chromium, 339 in Firefox), 20 px corners, 28 × 24 px padding, 6% white with backdrop-filter: blur(20px) and its -webkit- prefix, 10% white border. Inside, top to bottom: an uppercase violet #a78bfa badge on a 20% violet pill, the price in 35.2 px weight 800 with its unit in 14.4 px at 50% white, a 12 px billing line at 40%, a rule, a bullet-less list where each line carries a check mark — an SVG icon in a data: URI inside a 16 px circle, no external file —, and a full-width button in a violet → cyan gradient at 40% that goes to 60% on hover with a violet shadow, over 0.3 s. Behind the card, .glass-pricing-glow: a 200 px disc in a violet → cyan radial gradient, blurred at 30 px, that grows 20% and goes from 60 to 100% opacity over 6 s (pricingGlow).
The rim is the card's signature. The ::before pseudo-element overflows by one pixel (inset: -1px; padding: 1px), carries a 135° gradient — violet at 40%, transparent from 40 to 60%, cyan at 40% — and sits under the content (z-index: -1 within the card's context). A two-layer mask hollows it out: the first layer covers only the content box, the second the whole box, and composing them with exclude keeps only the one-pixel ring in between. The result: a violet top-left corner, a cyan bottom-right corner, sides that fade out in the middle — without a CSS gradient border, which doesn't exist with rounded corners.
The mask that hollows out the rim is written in two versions, each for a reason. The standard property uses mask-composite: exclude: xor only exists in the old -webkit-mask-composite property, and in mask it is an invalid value (CSS.supports false in Chromium 151, Firefox 153 and WebKit 26.5) that would make the browser drop the whole declaration. The gradient would then not be cut out and would tint the whole card — measured in pixels, violet (58, 44, 93) top left and cyan (18, 76, 88) bottom right. Before it, -webkit-mask and -webkit-mask-composite: xor serve older Safari. Measured result: mask applied in both engines, card interior neutral (24, 24, 29) at the same two points, rim visible. The blur also has its -webkit-backdrop-filter form. No JavaScript.
Accessibility
- Contrast, measured on the original background: price 15.7:1, unit 5.0:1, badge 5.1:1, list lines 5.7 to 6.4:1, button label 6.2:1 at worst (8 to 10:1 on average over the gradient) — all pass except one text: the billing line (40% white at 12 px, 3.6:1). Raise it to 65% white to pass 4.5:1.
- Structure: the price is a
div, the list a realul, the button a real<button>(it takes keyboard focus, measured). For a pricing page, give the offer a heading (anh3instead of or above the badge) and make the button an<a>link if it leads to a checkout page. The check marks are decorative (pseudo-elements): speech output reads the lines without them, which is correct. - Focus: the button has no
:focus-visiblestyle; the browser's default ring appears. Reuse the hover state (.glass-pricing-cta:focus-visible) and add a clear outline (outline: 2px solid #a78bfa; outline-offset: 2px). - No prefers-reduced-motion in the code: the glow keeps breathing under emulation. It is slow (6 s) and behind the glass;
@media (prefers-reduced-motion: reduce) { .glass-pricing-glow { animation: none } }freezes it if needed.
Browser compatibility
CSS only: backdrop-filter (+ -webkit-), a two-layer mask with mask-composite: exclude (+ -webkit-mask / -webkit-mask-composite: xor), SVG in a data: URI, gradients, @keyframes. Zero JavaScript, zero dependency. Standard mask: Chrome and Edge 120+, Firefox 53+, Safari 15.4+; the prefixed form covers Chrome 1–119 and older Safari. Measured in Chromium 151 and Firefox 153: mask computed, card interior neutral, gradient rim visible; same values in WebKit 26.5. Backdrop blur (Chrome 76+, Firefox 103+, Safari 9+ prefixed) is only painted in Chromium's screenshots; Firefox and WebKit under Playwright recognize it (blur(20px) computed) without drawing it, even on a minimal test.
Without masks (very old browser), the ::before gradient tints the whole card violet → cyan: readable, but with no rim. Without backdrop blur, the card stays a 6% white veil over the glow, already blurred by filter: blur(30px).
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="demo-preview">
<div class="glass-pricing-scene">
<div class="glass-pricing-glow"></div>
<div class="glass-pricing-card">
<div class="glass-pricing-badge">…</div>
<div class="glass-pricing-price">…<span>…</span></div>
<p class="glass-pricing-period">…</p>
<div class="glass-pricing-divider"></div>
<ul class="glass-pricing-features">
<li>…</li>
</ul>
<button class="glass-pricing-cta">…</button>
</div>
</div>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Rim colors (CSS — .glass-pricing-card::before { background: linear-gradient(135deg, …) }) |
violet at 40% → transparent (40–60%) → cyan at 40% | Replace both colors; raise the opacity to 80% for a crisp rim. Remove the transparent stretch (linear-gradient(135deg, #8b5cf6, #06b6d4)) for a continuous outline all round. |
Rim thickness (CSS — ::before { inset: -1px; padding: 1px }) |
1 px | The visible ring is as thick as the padding: set both values to 2 px (inset: -2px; padding: 2px) for a rim twice as strong. The mask doesn't need to change. |
Glass tint and blur (CSS — background: rgba(255,255,255,.06), backdrop-filter: blur(20px)) |
6% white, 20 px | Over a light photo (snow, sky), switch to a dark tint (rgba(15,35,70,.34)) to keep the white text readable. Over a very detailed background, 28 px of blur. |
Glow (CSS — .glass-pricing-glow, pricingGlow 6s) |
200 px, violet → cyan, 30 px blur, ×1.2 and 60 → 100% opacity over 6 s | Recolor it in the background's hue (blue over snow, pink at dusk). Remove the animation for a still glow, or the whole glow over an already rich photo. |
Button (CSS — .glass-pricing-cta) |
violet → cyan gradient at 40%, 60% on hover, violet shadow | For a button that reads better at rest, start at 60% and go to 80% on hover. Make it an <a> link (display: block; text-align: center) if it leads to a checkout page. |
List check marks (CSS — li::before, SVG in a data: URI) |
violet #a78bfa check in a 20% violet circle |
The color lives in the URI: replace %23a78bfa (the encoded #) with your hue. The icon depends on no file, so it survives copy-paste. |
FAQ
mask property, that operation is called exclude; xor is only accepted by the old -webkit-mask-composite property. Written in the standard property, xor is rejected by Chromium, Firefox and WebKit (measured: CSS.supports false in all three), which then drop the whole declaration: the pseudo-element is no longer hollowed out and its gradient covers the whole card. If you edit the mask, keep both versions, xor in the prefixed line and exclude in the standard one..glass-pricing-card in a grid (display: grid; grid-template-columns: repeat(3, 240px); gap: 24px) over the same rich background. Keep the badge, the rim and the glow on the single recommended offer — a rim on all three sets none apart — and give the other two a plain border.