Tutorials
Glass Card CSS: Liquid Glass and Glassmorphism Cards with Copy-Paste Code
Build a glass card in CSS, from a simple glassmorphism card to a liquid glass card with refraction, an image, a fully clickable link, hover lift and accessible fallbacks. Includes guidance on when not to put content in glass.

In short: A glass card in CSS uses a semi-transparent background, backdrop-filter blur and saturation, rounded corners and a light rim. A liquid glass card adds an SVG lens that bends the background at the edges. Use glass cards for emphasis over imagery, not for every card in a grid.
A glass card is the most requested glass component, and the easiest to overdo. This guide builds one in three levels: a classic glassmorphism card in eight lines, a liquid glass card with real refraction, and a complete product card with an image, a fully clickable link and hover motion. Each level works on its own.
We tested the code in Chromium. Safari and Firefox get the frosted version.
Level 1: a glassmorphism card in eight lines
.glass-card-simple {
padding: 24px;
border-radius: 24px;
color: #fff;
background: rgb(255 255 255 / .12);
border: 1px solid rgb(255 255 255 / .28);
-webkit-backdrop-filter: blur(16px) saturate(160%);
backdrop-filter: blur(16px) saturate(160%);
}
That’s classic glassmorphism: a blurred, tinted window with a thin border. It works in every modern browser and suits many designs. It doesn’t bend the background, which is the step up to liquid glass. See Glassmorphism vs liquid glass for the difference.
Level 2: the liquid glass card
HTML
<article class="glass-card">
<img class="glass-card__media" src="aurora.jpg" alt="" width="400" height="300">
<h3 class="glass-card__title">Aurora preset</h3>
<p class="glass-card__text">Clear glass with a violet rim and soft depth.</p>
<a class="glass-card__link" href="/presets/aurora">View preset</a>
</article>
The image has an empty alt because it’s decorative here: the title already says what the card is. Use a real description when the image carries information.
The surface
.glass-card {
position: relative;
isolation: isolate;
box-sizing: border-box;
width: min(100%, 320px);
padding: 24px;
border-radius: 32px;
color: #fff;
background: rgb(255 255 255 / .1);
-webkit-backdrop-filter: blur(14px) saturate(160%);
backdrop-filter: blur(14px) saturate(160%);
box-shadow:
inset 0 1px 0 rgb(255 255 255 / .5),
inset 0 -1px 0 rgb(255 255 255 / .1),
0 18px 40px rgb(0 0 0 / .28);
transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease;
}
.glass-card::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
border-radius: inherit;
padding: 1.5px;
background: linear-gradient(135deg, rgb(255 255 255 / .75), transparent 40% 60%, rgb(255 255 255 / .3));
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
-webkit-mask-composite: xor;
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
pointer-events: none;
}
Note the larger blur (14px) compared with buttons. Cards hold more text, so the frosted base has to calm the background more.
The lens
Cards are taller than buttons, so the displacement map is shaped for a portrait card with a 32px radius:
<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false">
<filter id="card-lens" x="0" y="0" width="1" height="1" primitiveUnits="objectBoundingBox" color-interpolation-filters="sRGB">
<feImage x="0" y="0" width="1" height="1" preserveAspectRatio="none" result="map"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='x'%3E%3Cstop offset='0' stop-color='rgb(64,0,0)'/%3E%3Cstop offset='1' stop-color='rgb(191,0,0)'/%3E%3C/linearGradient%3E%3ClinearGradient id='y' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='rgb(0,0,0)'/%3E%3Cstop offset='1' stop-color='rgb(0,255,0)'/%3E%3C/linearGradient%3E%3Cfilter id='b'%3E%3CfeGaussianBlur stdDeviation='10'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='300' height='400' rx='32' fill='url(%23x)'/%3E%3Crect width='300' height='400' rx='32' fill='url(%23y)' style='mix-blend-mode:screen'/%3E%3Crect x='26' y='26' width='248' height='348' rx='6' fill='rgb(128,128,128)' filter='url(%23b)'/%3E%3C/svg%3E"/>
<feDisplacementMap in="SourceGraphic" in2="map" scale="-0.14" xChannelSelector="R" yChannelSelector="G"/>
</filter>
</svg>
.lg-refract .glass-card {
-webkit-backdrop-filter: url(#card-lens) blur(3px) saturate(160%);
backdrop-filter: url(#card-lens) blur(3px) saturate(160%);
}
scale="-0.14" is gentler than a button’s. On a large surface a strong bend distorts too much of the background and makes it harder to read. Enable lg-refract with the detection script from the liquid glass CSS guide.
Level 3: image, clickable card and hover
.glass-card:hover {
transform: translateY(-4px);
box-shadow:
inset 0 1px 0 rgb(255 255 255 / .65),
inset 0 -1px 0 rgb(255 255 255 / .14),
0 26px 50px rgb(0 0 0 / .32);
}
.glass-card__media {
display: block;
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
border-radius: 20px;
margin-bottom: 18px;
}
.glass-card__title { margin: 0 0 6px; font: 700 20px/1.25 system-ui, sans-serif; }
.glass-card__text { margin: 0 0 18px; color: rgb(255 255 255 / .82); font: 400 15px/1.55 system-ui, sans-serif; }
.glass-card__link { color: #fff; font-weight: 600; }
.glass-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.glass-card:focus-within { outline: 2px solid #fff; outline-offset: 4px; }
- The whole card is clickable thanks to
.glass-card__link::after, which stretches an invisible layer over the card. The link text stays the accessible name, so a screen reader announces “View preset, link” instead of the card’s whole text. :focus-withindraws the focus ring around the card when the link is focused, so keyboard users see the full clickable area.- The hover lift uses a springy curve and a deeper shadow: the glass rises toward the light.
Accessibility fallbacks
@media (prefers-reduced-motion: reduce) {
.glass-card { transition: none; }
.glass-card:hover { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
.glass-card, .lg-refract .glass-card {
background: rgb(20 22 30 / .94);
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
}
Then check contrast: put the card over the busiest background it will appear on and measure the body text against it (WCAG asks for 4.5:1). See the accessible glass UI guide.
Glass card design tips
| Do | Avoid |
|---|---|
| Use glass for cards that float over imagery: hero highlights, feature callouts, media overlays | Glass for every card in a long list or grid: the result is noisy and slow |
| Keep 20–32px corner radii, matched in the displacement map | Mismatched radii: the lens bends a corner the card doesn’t have |
| One light direction across all cards | Rims lit from different angles |
| Stronger tint behind long text | Thin, clear glass behind paragraphs |
| Solid cards in dense content areas | Glass on glass (cards inside glass panels) |
Apple’s own guidance makes the same point: Liquid Glass is meant for controls and navigation that float above content, while content areas should use quieter materials. On the web that means a few glass cards for emphasis, not a glass grid. More in Apple Liquid Glass explained.
Frequently asked questions
How do I make a glass card in CSS?
Use a semi-transparent background, backdrop-filter: blur() saturate(), a light border or gradient rim, and rounded corners. For a liquid glass card, add an SVG displacement filter applied with backdrop-filter: url() in Chromium browsers.
What’s the difference between a glassmorphism card and a liquid glass card?
A glassmorphism card blurs the background. A liquid glass card also bends it at the edges like a thick lens, adds a directional light rim, and reacts to interaction.
How do I make the whole glass card clickable?
Put a normal link in the card and stretch an invisible ::after over the card from that link. That keeps a single, well-named link instead of wrapping all the content in <a>.
Why is my glass card’s text hard to read?
The background behind it is too busy, or the tint is too thin. Increase the blur and tint, add a subtle text shadow, or move the card over a calmer part of the image.
Can I generate glass card CSS automatically?
Yes. The UIGlass builder includes a card component with refraction, light, states and contrast checking, and exports CSS, HTML, React, Vue or Tailwind.
What is the best blur for a glass card?
Use about 12 to 16 pixels for the frosted fallback and 2 to 4 pixels when refraction is active. Text-heavy cards need more blur and tint than short labels.
How do I add a hover effect to a glass card?
Lift the card with transform: translateY(-4px), brighten the inset highlights and deepen the shadow. Use a springy easing and switch it off for reduced motion.
Should I use glass cards for every card on my site?
No. Use glass for a few cards that float over imagery, such as hero highlights or feature callouts. Long grids of glass cards are noisy, harder to read and slower to render.
How do I make a glass card on a white background?
Raise the tint to about 0.55 to 0.75 white, use dark text, and add a soft, slightly stronger shadow. Glass needs some colour or imagery behind it to look like glass.


