CSS Grainy Glass Panel

A frosted glass panel with a subtle film-grain texture from an inline SVG noise filter, shown as a now-playing widget.

  • glassmorphism
  • noise
  • grain
  • texture
  • feturbulence
  • music player
HTML
<section class="grain-glass" aria-label="Now playing">
  <span class="grain-glass-art" aria-hidden="true"></span>
  <div>
    <p class="grain-glass-title">Night Drive</p>
    <p class="grain-glass-artist">Coastline</p>
    <span class="grain-glass-bar" aria-hidden="true"></span>
  </div>
</section>
CSS
.grain-glass {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 250px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E"),
    rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: system-ui, sans-serif;
}

.grain-glass-art {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: conic-gradient(from 200deg, #fbbf24, #f472b6, #818cf8, #fbbf24);
}

.grain-glass > div {
  flex: 1;
}

.grain-glass p {
  margin: 0;
}

.grain-glass-title {
  font-size: 15px;
  font-weight: 700;
}

.grain-glass-artist {
  font-size: 13px;
  opacity: 0.75;
}

.grain-glass-bar {
  display: block;
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff 42%, rgba(255, 255, 255, 0.25) 0);
}

About this CSS Grainy Glass Panel

This CSS Grainy Glass Panel is 51 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses linear gradients, conic gradients, box shadows and backdrop filters. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #fff
  • #fbbf24
  • #f472b6
  • #818cf8

How to use this grainy glass panel

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .grain-glass class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback