Skip to main content

How to Create Glassmorphism Effect in CSS

Learn to create the trendy frosted glass UI effect using CSS backdrop-filter. Step-by-step tutorial with live interactive demo.

What is Glassmorphism?

Glassmorphism is a modern UI design style that creates a frosted glass effect. It's characterized by:

  • Semi-transparent backgrounds - Usually white or light colors with low opacity
  • Blur effect - The key ingredient using backdrop-filter: blur()
  • Subtle borders - Light borders that enhance the glass edge
  • Soft shadows - Adding depth without being too heavy

Made popular by Apple's iOS 7 and macOS Big Sur, glassmorphism is now used in modern web and app interfaces.

Glassmorphism

Frosted glass UI

Step-by-Step Tutorial

Follow these 5 simple steps to create the glassmorphism effect. Click any code block to copy.

1

Create the Background

Glassmorphism needs a colorful background to show through. Gradients work best - they make the blur effect really pop.

2

Add the Glass Element

Create a container element that will become your glass card. Set its dimensions and padding.

3

Apply backdrop-filter: blur()

This is the magic ingredient! The backdrop-filter property blurs everything behind the element. Include the -webkit- prefix for Safari.

4

Add Transparency with rgba()

Use rgba() for a semi-transparent background. The last value (0.15) is the opacity - lower values mean more transparency.

5

Add Subtle Border and Shadow

Finish with rounded corners, a subtle semi-transparent border, and a soft shadow for depth.

Live Interactive Demo

Adjust the sliders to customize your glassmorphism effect and copy the generated CSS.

Glassmorphism

Adjust the sliders

10px
15%
20%
.glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

Complete Code Example

Here's the complete CSS for a standard glassmorphism effect you can copy and use:

.glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

Browser Support

backdrop-filter Browser Support

The backdrop-filter property is supported in all modern browsers:

Chrome

76+

Firefox

103+

Safari

9+ (prefix)

Edge

79+

Opera

63+

Always include -webkit-backdrop-filter for Safari compatibility. For older browsers, the effect gracefully degrades to just the semi-transparent background.

Glassmorphism Variations

Try different colors and blur amounts to create unique glass effects.

Light Glass

Light Glass

Dark Glass

Dark Glass

Heavy Blur

Heavy Blur

Colored Glass

Colored Glass

Frequently Asked Questions

What is glassmorphism in CSS?

Glassmorphism is a modern UI design trend that creates a frosted glass effect. It uses semi-transparent backgrounds, blur effects (via backdrop-filter), subtle borders, and shadows to make elements look like they're made of frosted glass. The effect became popular after Apple's iOS 7 and macOS Big Sur redesigns.

Does backdrop-filter work in all browsers?

backdrop-filter has excellent browser support in 2024/2025, working in Chrome, Edge, Safari, Firefox, and Opera. However, you should always include the -webkit- prefix for Safari compatibility. For older browsers, the effect will gracefully degrade to just the semi-transparent background without the blur.

How do I make the glass effect darker?

To create a darker glass effect, use rgba() with a dark color instead of white. For example, use 'background: rgba(0, 0, 0, 0.2)' for a dark tint. You can also reduce the blur amount and increase the background opacity for a more solid, darker appearance.

What background works best with glassmorphism?

Glassmorphism works best over colorful, gradient, or image backgrounds. The blur effect needs something interesting behind it to be visible. Solid color backgrounds won't show the glass effect well. Gradients with multiple colors, abstract shapes, or photographs make the frosted glass effect really stand out.

How to add glassmorphism in Tailwind CSS?

In Tailwind CSS, you can create glassmorphism with: 'bg-white/20 backdrop-blur-lg rounded-2xl border border-white/30 shadow-lg'. The 'backdrop-blur-lg' class applies the blur, 'bg-white/20' creates a semi-transparent white background, and 'border-white/30' adds the subtle border.