Frontend

Implementing Glassmorphism in CSS

What Is Glassmorphism?

Glassmorphism is one of the most popular UI design trends of the 2020s. It simulates the look of frosted glass:

  • Semi-transparent backgrounds
  • Background blur
  • Subtle borders
  • Layered shadows

Core CSS

Glassmorphism requires just three properties working together:

.glass-card {
  /* 1. Semi-transparent background โ€” required for blur to show */
  background: rgba(15, 23, 42, 0.55);

  /* 2. Background blur โ€” the core magic */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  /* 3. Subtle border โ€” enhances the glass feel */
  border: 1px solid rgba(148, 163, 184, 0.08);

  /* 4. Layered shadows โ€” adds depth */
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

How BePhil Uses Glassmorphism

BePhil applies glassmorphism throughout the site:

  • Header โ€” frosted glass appears on scroll
  • Post cards โ€” glass surface intensifies on hover
  • Stats cards โ€” glass panels over the dark background
  • Search bar โ€” translucent input with blurred backdrop

Caveats

Beautiful as it is, glassmorphism has trade-offs:

  1. Performance โ€” backdrop-filter is a GPU operation; excessive use degrades performance
  2. Readability โ€” ensure sufficient text contrast (WCAG AA minimum)
  3. Fallbacks โ€” provide solid-color fallbacks for unsupported browsers

Good design is transparent โ€” in both senses of the word.

Newman

Writer and builder at BePhil. Passionate about design systems, frontend engineering, and clear thinking.