GlassmorphismPremium

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.

CSSPricingGradient

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

Season pass over the photo of the slopes — family ski resort website — Glass Pricing Card example 1

① Season pass over the photo of the slopes — family ski resort website

WhenThe "Lift passes" page: the photo of snowy slopes in the background, the glass card details the season pass and its perks.
WhyThe glass keeps the snow and sky visible behind the price; the gradient rim sets the recommended offer apart without an opaque background. On the left, the simple prices (day, six days) stay as text: only one offer is in glass, the one the resort wants to sell.
SettingsMountain, runs, fir trees and a chairlift whose chairs move, painted in CSS; card at its original width (240 px) on the right, vertical padding reduced from 28 to 22 px to fit the frame; dark tint rgba(15,35,70,.34) instead of 6% white because the snow is light; glow recolored blue; original rim, badge, checked list and button.
Annual membership of a bouldering gym — Glass Pricing Card example 2

② Annual membership of a bouldering gym

WhenThe prices page: the photo of a wall of colored holds in the background, the card presents the annual membership and what it includes (lessons, shoe rental).
WhyThe multicolored holds still show through the card, and the checked list reads the offer line by line, as at the front desk. The dark wall lets the card keep its original 6% white tint, without darkening the glass.
SettingsA wall of 70 holds of random shapes and colors on gridded panels, a spotlight sweeping the wall over 3.2 s; original card and glow (6% white, violet → cyan), vertical padding at 22 px; price "€420/year" with the monthly option as the billing line; four short perks so each fits on one line.
Three-day museum pass — tourist office website — Glass Pricing Card example 3

③ Three-day museum pass — tourist office website

WhenThe visitor compares passes: the glass card over a photo of the town gives price, included museums and free transport.
WhyThe gradient rim makes the featured pass stand out; the town backdrop stays visible and sells the destination as much as the price. The 24 h and 48 h passes stay as a simple list on the left: the card is used once per page.
SettingsOld town at dusk (roofs, spire, lit windows, reflections rippling on the river); original card on the right, vertical padding at 22 px; glow recolored pink → orange to echo the sky; badge "3-day pass", price "€45 for 3 days".

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 real ul, the button a real <button> (it takes keyboard focus, measured). For a pricing page, give the offer a heading (an h3 instead 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-visible style; 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.

Chrome 76+✓ Full (prefixed mask before 120)
Firefox 103+✓ Full (blur not verifiable in automated screenshots)
Safari 9+✓ Full (-webkit- prefixes included)
Edge 79+✓ Full
Mobile iOS 9+✓ Full
Android Chrome 76+✓ Full

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):

index.html — structure
<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 / propertyDefaultEffect
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

Because the two syntaxes do not accept the same words. Cutting out the one-pixel ring means subtracting the content area from the whole box: in the standard 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.
Yes: the card is 240 px wide and has no absolute positioning. Put three .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.
Glass Card is a generic information card: title, subtitle, lift on hover, three orbs floating behind. Glass Pricing Card is built for a priced offer: badge, price and unit, billing line, checked list, call-to-action button, and above all the masked gradient rim that sets it apart from a neighboring card. It doesn't move on hover; only its button reacts, and its glow breathes slowly behind it.