StealThis .dev

Glassmorphism Card

A frosted-glass card effect using CSS backdrop-filter, subtle borders, and layered transparency.

Open in Lab
cssbackdrop-filter
Targets: TS JS HTML React

Code

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0f172a;
}

/* Gradient background blobs */
.bg {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(56, 189, 248, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 500px 350px at 80% 70%, rgba(168, 85, 247, 0.25) 0%, transparent 70%),
    #0f172a;
}

/* --- Glass card --- */
.glass-card {
  width: min(380px, calc(100vw - 2rem));
  padding: 2.5rem;
  border-radius: 1.5rem;

  /* Glass effect */
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 4px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);

  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: #f1f5f9;
}

.card-icon {
  font-size: 1.75rem;
  line-height: 1;
  color: #38bdf8;
}

.card-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #94a3b8;
}

.card-body code {
  font-family: "Fira Code", monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 0.3em;
  color: #a5b4fc;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.card-btn {
  margin-top: 0.5rem;
  align-self: flex-start;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.card-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.card-btn:active {
  transform: translateY(0);
}

Glassmorphism Card

A modern glassmorphism card component using backdrop-filter: blur() for a frosted-glass appearance, combined with semi-transparent backgrounds and soft borders.

How it works

The effect relies on three CSS properties working together:

  1. backdrop-filter: blur(12px) — blurs content behind the card
  2. background: rgba(255,255,255,0.08) — semi-transparent background
  3. border: 1px solid rgba(255,255,255,0.12) — subtle light border

Browser support

backdrop-filter is supported in all modern browsers. For Firefox, prefix with -webkit-backdrop-filter for older versions.

When to use it

  • Feature cards on dark/gradient backgrounds
  • Modal dialogs over blurred content
  • Navigation panels with transparent feel