How to Make Glassmorphism (Frosted Glass Effect) With CSS
Updated: October 13, 2026 · AracMerkezi
▶ Open Glassmorphism CSS Generator
Glassmorphism is a design approach that gives a "frosted glass" effect by blurring the content behind an interface element. It is popular for cards, menus and modal windows. You can achieve the effect with a few lines of CSS.
Basic CSS
The effect has four parts:
- Semi-transparent background:
background: rgba(255, 255, 255, 0.2); - Blurring the backdrop:
backdrop-filter: blur(12px); - A thin border:
border: 1px solid rgba(255, 255, 255, 0.3); - Soft shadow and corners:
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15); border-radius: 16px;
For some versions of Safari, a prefix is also added: -webkit-backdrop-filter: blur(12px);
The most important requirement: there must be something visual behind it
backdrop-filter blurs the pixels behind the element. If the background is plain white, there is nothing to blur and the effect goes unnoticed. To see the effect, put an image, colorful shapes or a gradient behind it. The CSS Gradient Generator makes it easier to prepare a gradient.
How to choose the values?
| Property | Typical range | Effect |
|---|---|---|
| Background opacity | 0.1 – 0.35 | A low value is more transparent, a high value is more matte |
| Blur | 8 – 20 px | A high value erases more of the background |
| Saturation (saturate) | 120 – 180% | Brightens the colors behind the glass |
| Border opacity | 0.2 – 0.4 | Makes the edge of the glass more distinct |
Example with saturation: backdrop-filter: blur(12px) saturate(150%);
Support and fallback
backdrop-filter works in most modern browsers, but it is not supported in older versions and some specialized browsers. When it is not supported, the glass remains a semi-transparent color and the text can become unreadable. The safe way is to give an opaque background first and make it transparent only if there is support:
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) { .glass { background: rgba(255,255,255,0.2); } }
Outside this rule, define a darker, opaque fallback color for .glass.
Performance
Blurring is expensive for the browser. On large areas, with many overlapping elements, and on low-power mobile devices, it can cause stutter. Tips:
- Avoid very large blur values.
- Do not use many glass elements on the same page.
- Do not constantly change the blur value in animations.
Accessibility and readability
The glass effect changes the content behind the text; if the background moves or has colorful regions, the contrast can shift. Check the contrast ratio between the text and the worst background point; for WCAG AA, aim for at least 4.5:1 for normal text. Use the Color Contrast Checker (WCAG) for this. If you cannot achieve sufficient contrast for the text, reduce the glass transparency or add a dark layer behind it. For users who have a reduced-motion preference, consider disabling moving backgrounds.
A ready example
On a colorful gradient background, you can give the .glass class the following: a semi-transparent white background (0.2), 12 pixels of blur, 150% saturation, a 1-pixel light border, 16-pixel corners and a light shadow. On dark-themed pages, using dark blue or black (e.g., rgba(15, 23, 42, 0.4)) instead of white as the glass color makes the text more readable.
Common mistakes
- Raising the values excessively because the effect is not visible when the background is a plain color.
- Making every card on the page glass and hurting performance.
- Testing text contrast at only a single background point.
- Not providing a fallback color for browsers without support.
Tools
The Glassmorphism CSS Generator produces ready CSS from color, opacity, blur and corner values. To adjust the shadow separately, see the CSS Box Shadow Generator.
Frequently asked questions
Which CSS property is needed for glassmorphism?
Basically, a semi-transparent background color is used together with backdrop-filter: blur(); the border and shadow complete the look.
Why isn't the effect visible?
backdrop-filter blurs the content behind the element; if the background is a plain color it goes unnoticed. Put an image or gradient behind it.
Does the glass effect hurt readability?
Text contrast can drop as the background changes; aim for at least 4.5:1 and, if necessary, reduce the transparency or add a dark layer.
Tools mentioned in this guide
More guides
- How to Choose a Color Palette for a Website: Building a Full Palette From One Color – How to choose a website color palette: build tints, accents and neutrals from one HEX color, with the 60-30-10 rule, contrast values and CSS variables.
- How to Make Fluid Font Sizes with CSS clamp(): Formula, Ready Values and Glassmorphism – How is CSS clamp(min, preferred, max) calculated? The formula for fluid type between two screen widths, 3 worked examples, rem and accessibility notes.
- How to Convert HEX to RGB Color Codes: Step-by-Step Examples – How to convert a HEX color code to RGB and back: hexadecimal basics, short and 8-digit HEX, darkening math and verified JavaScript and Python snippets.
- What Is Color Contrast Ratio? A Step-by-Step WCAG AA and AAA Calculation with Example Colors – How is color contrast ratio calculated? WCAG AA and AAA thresholds (4.5:1, 3:1, 7:1), the luminance formula, worked color examples and tips.
- What Is the Difference Between PX, REM and EM? CSS Units, a Conversion Table and Which to Use When – What is the difference between px, rem and em in CSS, and which to use when? The px-to-rem formula, an em compounding example and a 16 px conversion table.
This article is for general information only and is not legal, financial or medical advice. We are not an official institution.