<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DEVLYO</title>
    <description>The latest articles on DEV Community by DEVLYO (@devlyo).</description>
    <link>https://dev.to/devlyo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4256056%2F27cb2ad1-d9b2-4b24-bff6-23513278b47a.png</url>
      <title>DEV Community: DEVLYO</title>
      <link>https://dev.to/devlyo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devlyo"/>
    <language>en</language>
    <item>
      <title>Glassmorphism in CSS: how it works + a free live generator</title>
      <dc:creator>DEVLYO</dc:creator>
      <pubDate>Fri, 20 Nov 2026 17:02:42 +0000</pubDate>
      <link>https://dev.to/devlyo/glassmorphism-in-css-how-it-works-a-free-live-generator-48m9</link>
      <guid>https://dev.to/devlyo/glassmorphism-in-css-how-it-works-a-free-live-generator-48m9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fskur3ahiz9mw622xplek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fskur3ahiz9mw622xplek.png" alt="Glassmorphism CSS: a frosted glass card over colourful blurred circles" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Glassmorphism is the frosted glass look you see on Apple's interfaces, in Windows, and on half of the landing pages on Dribbble: a translucent card that blurs whatever is behind it, with a thin bright edge that catches the light.&lt;/p&gt;

&lt;p&gt;It looks expensive, but in CSS it comes down to &lt;strong&gt;four properties&lt;/strong&gt;. This guide explains each one, gives you a copy-paste class, covers the mistakes that make glass look like grey plastic, and links to a &lt;strong&gt;free live generator&lt;/strong&gt; where you can tune every value with sliders and copy the result.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://devlyo.com/p/53vY113" rel="noopener noreferrer"&gt;Open the live glassmorphism generator&lt;/a&gt;&lt;/strong&gt;: drag the sliders, watch the card change, press &lt;strong&gt;Get the CSS&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four ingredients of glass
&lt;/h2&gt;

&lt;p&gt;Real frosted glass does four things to the light that passes through it. Each one maps to a line of CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. A faint tint
&lt;/h3&gt;

&lt;p&gt;Glass is never fully clear. A white background at 10–20% opacity gives it body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go above about 30% and it stops looking like glass and starts looking like a white card.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Blur what's behind it
&lt;/h3&gt;

&lt;p&gt;This is the heart of the effect. &lt;code&gt;backdrop-filter&lt;/code&gt; applies a filter to everything &lt;strong&gt;behind&lt;/strong&gt; the element, not to the element itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;-webkit-backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="cm"&gt;/* Safari */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Between 10px and 24px looks like frosted glass. Under 6px it just looks smudged.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Boost the saturation
&lt;/h3&gt;

&lt;p&gt;Blurring washes colours out. Real glass doesn't. Add &lt;code&gt;saturate()&lt;/code&gt; in the same filter and the colours behind the card come back to life:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one line is the difference between "nice" and "wow". Most tutorials skip it.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. A lit edge
&lt;/h3&gt;

&lt;p&gt;Light catches the edge of a pane of glass. A thin, semi-transparent white border plus a 1px inner highlight on top sells the thickness:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1px&lt;/span&gt; &lt;span class="nt"&gt;solid&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.28&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;30px&lt;/span&gt; &lt;span class="mi"&gt;60px&lt;/span&gt; &lt;span class="nt"&gt;-20px&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.55&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="cm"&gt;/* lifts it off the page */&lt;/span&gt;
  &lt;span class="nt"&gt;inset&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;1px&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.38&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="cm"&gt;/* light on the top edge */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The complete class
&lt;/h2&gt;

&lt;p&gt;Put the four together and you have a reusable glass panel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.glass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1px&lt;/span&gt; &lt;span class="n"&gt;solid&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.28&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;22px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;30px&lt;/span&gt; &lt;span class="mi"&gt;60px&lt;/span&gt; &lt;span class="n"&gt;-20px&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.55&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inset&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;1px&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.38&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Want different values? Don't guess and refresh. &lt;strong&gt;&lt;a href="https://devlyo.com/p/53vY113" rel="noopener noreferrer"&gt;Tune them live in the generator&lt;/a&gt;&lt;/strong&gt;: blur, saturation, tint, edge light, corner radius and colours are all sliders, and &lt;strong&gt;Get the CSS&lt;/strong&gt; gives you this exact rule with your numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why your glass looks like grey plastic
&lt;/h2&gt;

&lt;p&gt;If you copied a glass class and it looks flat, it's almost always one of these.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There's nothing behind it.&lt;/strong&gt; Blur only shows when there is something to blur. On a flat background, glass is just a grey box. Put colourful shapes, a photo or a gradient behind it. In the generator, three blurred circles drift behind the card for exactly this reason.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The tint is too strong.&lt;/strong&gt; Above roughly 0.3 opacity the background wins and the blur disappears. Start at 0.1 and go up slowly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You forgot saturation.&lt;/strong&gt; Blur alone desaturates. Add &lt;code&gt;saturate(140%–180%)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No edge.&lt;/strong&gt; Without the thin white border the card has no thickness and melts into the background.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dark text on a busy background.&lt;/strong&gt; Glass changes as things move behind it, so text needs contrast everywhere. White text with a soft shadow, or a slightly stronger tint behind long text, keeps it readable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Browser support and performance
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;backdrop-filter&lt;/code&gt; works in every current browser: Chrome, Edge, Firefox (since version 103) and Safari (keep the &lt;code&gt;-webkit-&lt;/code&gt; prefix for older iOS versions).&lt;/p&gt;

&lt;p&gt;It isn't free, though. The browser has to re-blur everything behind the element whenever something under it moves. A few glass panels are fine. Dozens of large, overlapping ones on an animated page will cost frames, especially on low-end phones. Two tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep blurred areas small and few. Use glass for cards, navbars and dialogs, not whole page sections.&lt;/li&gt;
&lt;li&gt;If you need a fallback for very old browsers, give the element a stronger solid tint first, then add the blur inside &lt;code&gt;@supports (backdrop-filter: blur(1px)) { … }&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Accessibility
&lt;/h2&gt;

&lt;p&gt;Glass is decoration, so make sure it doesn't cost readability:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check text contrast against the &lt;strong&gt;busiest&lt;/strong&gt; part of what can sit behind the card, not the calmest.&lt;/li&gt;
&lt;li&gt;Respect &lt;code&gt;prefers-reduced-transparency&lt;/code&gt; where it's supported, and fall back to a solid background:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-reduced-transparency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.glass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;Reading about blur values only goes so far. The fastest way to get a feel for glassmorphism is to drag the sliders and watch:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://devlyo.com/p/53vY113" rel="noopener noreferrer"&gt;Open the glassmorphism generator&lt;/a&gt;&lt;/strong&gt; and move the Blur, Saturation and Glass tint sliders.&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Get the CSS&lt;/strong&gt; to copy your version.&lt;/li&gt;
&lt;li&gt;Want to keep it, change the background or build your own card on top? &lt;strong&gt;Remix&lt;/strong&gt; it on Devlyo: you get your own editable copy that runs live, and you can share it with a link.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Devlyo is a place for developers to share code that actually runs: live components, shaders and Three.js demos with sliders anyone can play with. If you build a glass effect of your own, post it there, and the best ones get featured.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://devlyo.com/blog/glassmorphism-in-css-how-it-works-free-live-generator" rel="noopener noreferrer"&gt;Devlyo&lt;/a&gt;, where you can play with the live generator.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>frontend</category>
      <category>design</category>
    </item>
  </channel>
</rss>
