---
name: css-glassmorphism-generator
description: "Generates the CSS for a frosted-glass UI card from your color, opacity, and blur values, in plain CSS, Tailwind classes, or Styled Components, with a fallback for browsers that lack blur. Use when a front-end developer wants a glassmorphism or frosted-glass card with exact color, opacity, and blur values in a specific code format. Do not use for general page layout, animated effects, or design system tokens. Related topics: design, css, coding."
---

# CSS Glassmorphism Generator

Generates the CSS for a frosted-glass UI card from your color, opacity, and blur values, in plain CSS, Tailwind classes, or Styled Components, with a fallback for browsers that lack blur.

## When to use

Use this skill when a front-end developer wants a glassmorphism or frosted-glass card with exact color, opacity, and blur values in a specific code format. Do not use it for general page layout, animated effects, or design system tokens.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Convert the background color and opacity percentage to an rgba value.
3. Apply backdrop-filter blur with the -webkit- prefix, then add the border and shadow only if they were requested.
4. Output the result in the chosen format, using arbitrary values in Tailwind where no utility fits.
5. Add a fallback for browsers without backdrop-filter and a note on background and contrast.

## Inputs

- **Background color** (free text, e.g. "#ffffff for light or #000000 for dark")
- **Glass opacity in percent** (number from 1 to 100)
- **Blur amount in px** (number from 1 to 50)
- **Include a border** (choose one: Yes, No)
- **Border color and opacity** (free text, e.g. "rgba(255 255 255 0.2)")
- **Add a box shadow for depth** (choose one: Yes, No)
- **Output format** (choose one: Raw CSS, Tailwind CSS classes, Styled Components)

## Output

A single code block in the chosen format with the glass effect, a fallback block, and two short notes on the background and text contrast.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### CSS Glassmorphism Generator

Create a glassmorphism effect for a UI element.

- Background color: {{Background color}}
- Glass opacity in percent: {{Glass opacity in percent}}
- Blur amount in px: {{Blur amount in px}}
- Include a border: {{Include a border}}
- Border color and opacity: {{Border color and opacity}}
- Add a box shadow for depth: {{Add a box shadow for depth}}
- Output format: {{Output format}}

Convert the color and opacity into an rgba background and apply backdrop-filter: blur() with the -webkit- prefix as well. Add a border and shadow only when asked. Match the output to the chosen format; for Tailwind, use the closest utility classes and an arbitrary value where none fits.

Include a fallback with @supports not (backdrop-filter: blur(1px)) that raises the opacity so text stays readable. Add one line on what sits behind the element, since the effect only shows over a colorful or image background, and one note on text contrast.

## Pitfalls

- Forgetting the -webkit-backdrop-filter prefix, so Safari shows no blur.
- Using a very low opacity on a plain background, so the card looks unfinished.
- Placing text on the glass without checking contrast against the busiest part of the background.
