Pure TailwindMIT licensed

Tailwind Glassmorphism Frosted Navbar

The frosted sticky bar, and the first thing worth porting: backdrop-blur-xl backdrop-saturate-150 over a bg-white/8 fill, sticky at the top, with a checkbox-driven mobile menu. The CSS original needs a second hand-built mobile bar; here the same bar carries both layouts, because the breakpoint is a prefix on the element that changes.

Live Demo
Plain CSSTailwind v4
Try it

Complete Tailwind CSS landing page templates in HTML, React, Next.js and Vue · from $49

Cruip · Affiliate link

Browse Cruip templates

The code

<div class="tnb-01 group w-full min-h-svh bg-linear-[160deg,var(--color-tnb01-bg1),var(--color-tnb01-bg2)] font-tnb01-sans text-tnb01-ink" aria-label="Glassmorphism frosted navbar demo">
  <input type="checkbox" id="tnb01-menu" class="sr-only peer" aria-label="Toggle navigation menu">
  <header class="sticky top-0 z-100 border-b border-white/15 bg-white/8 backdrop-blur-xl backdrop-saturate-150">
    <nav class="mx-auto flex h-16 max-w-7xl items-center justify-between gap-4 px-5 md:px-8" aria-label="Primary">
      <a href="#home" class="flex shrink-0 items-center gap-2.5 text-lg font-extrabold tracking-[-0.02em] text-tnb01-ink no-underline">
        <span class="grid size-8 place-items-center rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] text-base text-white" aria-hidden="true">&#10022;</span>Prisma
      </a>
      <ul class="hidden list-none items-center gap-1 md:flex">
        <li><a href="#home" aria-current="page" class="relative rounded-lg bg-tnb01-acc/15 px-3.5 py-2 text-sm font-medium text-tnb01-acc no-underline transition-colors duration-200 after:absolute after:-bottom-0.5 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full after:bg-tnb01-acc after:content-[''] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Home</a></li>
        <li><a href="#products" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Products</a></li>
        <li><a href="#pricing" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Pricing</a></li>
        <li><a href="#blog" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Blog</a></li>
        <li><a href="#about" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">About</a></li>
      </ul>
      <div class="hidden shrink-0 items-center gap-3 md:flex">
        <a href="#signin" class="rounded-lg border border-white/15 px-4 py-2 text-sm font-semibold text-tnb01-ink no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Sign in</a>
        <a href="#start" class="rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] px-4 py-2 text-sm font-semibold text-white no-underline transition-[opacity,translate] duration-200 hover:-translate-y-px hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white motion-reduce:transition-none motion-reduce:hover:translate-y-0">Get started</a>
      </div>
      <label for="tnb01-menu" class="flex size-11 cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg md:hidden" aria-hidden="true">
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-transform duration-300 group-has-checked:translate-y-2 group-has-checked:rotate-45 motion-reduce:transition-none"></span>
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-opacity duration-300 group-has-checked:opacity-0 motion-reduce:transition-none"></span>
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-transform duration-300 group-has-checked:-translate-y-2 group-has-checked:-rotate-45 motion-reduce:transition-none"></span>
      </label>
    </nav>
    <div class="hidden border-t border-white/10 bg-tnb01-bg2/95 px-5 py-4 backdrop-blur-xl max-md:group-has-checked:grid">
      <a href="#home" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-acc no-underline">Home</a>
      <a href="#products" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Products</a>
      <a href="#pricing" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Pricing</a>
      <a href="#blog" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Blog</a>
      <a href="#about" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">About</a>
      <div class="mt-3 flex gap-3 border-t border-white/10 pt-4">
        <a href="#signin" class="flex min-h-11 flex-1 items-center justify-center rounded-lg border border-white/15 text-sm font-semibold text-tnb01-ink no-underline">Sign in</a>
        <a href="#start" class="flex min-h-11 flex-1 items-center justify-center rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] text-sm font-semibold text-white no-underline">Get started</a>
      </div>
    </div>
  </header>
  <main class="mx-auto max-w-3xl px-5 py-16 md:px-8">
    <h1 class="mb-4 bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] bg-clip-text text-4xl font-extrabold tracking-[-0.03em] text-transparent md:text-5xl">Glassmorphism Navbar</h1>
    <p class="text-lg leading-relaxed text-tnb01-ink/65">Narrow the window past <code class="rounded bg-white/10 px-1.5 py-0.5 text-[0.9em]">md</code> and the same bar becomes the hamburger layout — one navbar, two class lists. Scroll: the bar stays, and <code class="rounded bg-white/10 px-1.5 py-0.5 text-[0.9em]">backdrop-blur-xl</code> blurs the gradient behind it.</p>
    <div class="mt-10 grid gap-4 sm:grid-cols-3">
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">Translucent fill first — blur over opaque paint is a no-op.</div>
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">State lives on the element: <code>group-has-checked:</code>, not a sibling chain.</div>
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">44px rows on mobile, declared as <code>min-h-11</code>.</div>
    </div>
  </main>
</div>
@import "tailwindcss";

@theme {
  --color-tnb01-bg1: #14102b;
  --color-tnb01-bg1: oklch(0.22 0.06 285);
  --color-tnb01-bg2: #241a4d;
  --color-tnb01-bg2: oklch(0.3 0.09 288);
  --color-tnb01-ink: #f0eeff;
  --color-tnb01-ink: oklch(0.95 0.02 290);
  --color-tnb01-acc: #a78bfa;
  --color-tnb01-acc: oklch(0.74 0.15 295);
  --color-tnb01-acc2: #60a5fa;
  --color-tnb01-acc2: oklch(0.73 0.14 255);
  --font-tnb01-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's
   w-full min-h-svh, so the stage is sized before the browser build compiles. */

.tnb-01 {
  width: 100%;
  min-height: 100svh;
}

.tnb-01 ::selection {
  background: var(--color-tnb01-acc);
  color: #14102b;
}

Setup — do this once per project

Skip this if your project already runs Tailwind v4.

1Load Tailwind
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

Compiles in the browser — perfect for a CodePen or a quick test, not for production.

2Add the stylesheetRequiredthe @theme block is what makes the custom utilities exist
@import "tailwindcss";

@theme {
  --color-tnb01-bg1: #14102b;
  --color-tnb01-bg1: oklch(0.22 0.06 285);
  --color-tnb01-bg2: #241a4d;
  --color-tnb01-bg2: oklch(0.3 0.09 288);
  --color-tnb01-ink: #f0eeff;
  --color-tnb01-ink: oklch(0.95 0.02 290);
  --color-tnb01-acc: #a78bfa;
  --color-tnb01-acc: oklch(0.74 0.15 295);
  --color-tnb01-acc2: #60a5fa;
  --color-tnb01-acc2: oklch(0.73 0.14 255);
  --font-tnb01-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's
   w-full min-h-svh, so the stage is sized before the browser build compiles. */

.tnb-01 {
  width: 100%;
  min-height: 100svh;
}

.tnb-01 ::selection {
  background: var(--color-tnb01-acc);
  color: #14102b;
}
3Fonts used by this demooptional — skip if you have your own type stack
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap">

What changed in the port

Which parts became utilities, which stayed CSS, and why.

  • Three #toggle:checked ~ .bar span:nth-child(n) chains become group-has-checked: on the three bars themselves — the hamburger now describes its own X state.
  • The CSS original's @media (max-width:768px) block that hid the desktop links and showed the hamburger is gone; hidden md:flex and md:hidden say it on the elements.
  • supports-[backdrop-filter]: is a variant rather than a separate @supports block, so the fallback sits next to the effect.
  • The @media (prefers-reduced-motion) block collapses into motion-reduce:transition-none on the four elements that actually animate.
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Glassmorphism Frosted Navbar
Source: https://codefronts.com/navigation/tailwind-css-responsive-navbars/tailwind-glassmorphism-frosted-navbar/

The frosted sticky bar, and the first thing worth porting: backdrop-blur-xl backdrop-saturate-150 over a bg-white/8 fill, sticky at the top, with a checkbox-driven mobile menu. The CSS original needs a second hand-built mobile bar; here the same bar carries both layouts, because the breakpoint is a prefix on the element that changes.
## HTML
```html
<div class="tnb-01 group w-full min-h-svh bg-linear-[160deg,var(--color-tnb01-bg1),var(--color-tnb01-bg2)] font-tnb01-sans text-tnb01-ink" aria-label="Glassmorphism frosted navbar demo">
  <input type="checkbox" id="tnb01-menu" class="sr-only peer" aria-label="Toggle navigation menu">
  <header class="sticky top-0 z-100 border-b border-white/15 bg-white/8 backdrop-blur-xl backdrop-saturate-150">
    <nav class="mx-auto flex h-16 max-w-7xl items-center justify-between gap-4 px-5 md:px-8" aria-label="Primary">
      <a href="#home" class="flex shrink-0 items-center gap-2.5 text-lg font-extrabold tracking-[-0.02em] text-tnb01-ink no-underline">
        <span class="grid size-8 place-items-center rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] text-base text-white" aria-hidden="true">&#10022;</span>Prisma
      </a>
      <ul class="hidden list-none items-center gap-1 md:flex">
        <li><a href="#home" aria-current="page" class="relative rounded-lg bg-tnb01-acc/15 px-3.5 py-2 text-sm font-medium text-tnb01-acc no-underline transition-colors duration-200 after:absolute after:-bottom-0.5 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full after:bg-tnb01-acc after:content-[''] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Home</a></li>
        <li><a href="#products" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Products</a></li>
        <li><a href="#pricing" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Pricing</a></li>
        <li><a href="#blog" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Blog</a></li>
        <li><a href="#about" class="rounded-lg px-3.5 py-2 text-sm font-medium text-tnb01-ink/75 no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 hover:text-tnb01-acc focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">About</a></li>
      </ul>
      <div class="hidden shrink-0 items-center gap-3 md:flex">
        <a href="#signin" class="rounded-lg border border-white/15 px-4 py-2 text-sm font-semibold text-tnb01-ink no-underline transition-colors duration-200 hover:bg-tnb01-acc/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tnb01-acc">Sign in</a>
        <a href="#start" class="rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] px-4 py-2 text-sm font-semibold text-white no-underline transition-[opacity,translate] duration-200 hover:-translate-y-px hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white motion-reduce:transition-none motion-reduce:hover:translate-y-0">Get started</a>
      </div>
      <label for="tnb01-menu" class="flex size-11 cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg md:hidden" aria-hidden="true">
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-transform duration-300 group-has-checked:translate-y-2 group-has-checked:rotate-45 motion-reduce:transition-none"></span>
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-opacity duration-300 group-has-checked:opacity-0 motion-reduce:transition-none"></span>
        <span class="block h-0.5 w-5.5 rounded-sm bg-tnb01-ink transition-transform duration-300 group-has-checked:-translate-y-2 group-has-checked:-rotate-45 motion-reduce:transition-none"></span>
      </label>
    </nav>
    <div class="hidden border-t border-white/10 bg-tnb01-bg2/95 px-5 py-4 backdrop-blur-xl max-md:group-has-checked:grid">
      <a href="#home" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-acc no-underline">Home</a>
      <a href="#products" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Products</a>
      <a href="#pricing" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Pricing</a>
      <a href="#blog" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">Blog</a>
      <a href="#about" class="flex min-h-11 items-center rounded-lg px-3 text-[15px] font-medium text-tnb01-ink/80 no-underline transition-colors hover:bg-tnb01-acc/15 hover:text-tnb01-acc">About</a>
      <div class="mt-3 flex gap-3 border-t border-white/10 pt-4">
        <a href="#signin" class="flex min-h-11 flex-1 items-center justify-center rounded-lg border border-white/15 text-sm font-semibold text-tnb01-ink no-underline">Sign in</a>
        <a href="#start" class="flex min-h-11 flex-1 items-center justify-center rounded-lg bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] text-sm font-semibold text-white no-underline">Get started</a>
      </div>
    </div>
  </header>
  <main class="mx-auto max-w-3xl px-5 py-16 md:px-8">
    <h1 class="mb-4 bg-linear-[135deg,var(--color-tnb01-acc),var(--color-tnb01-acc2)] bg-clip-text text-4xl font-extrabold tracking-[-0.03em] text-transparent md:text-5xl">Glassmorphism Navbar</h1>
    <p class="text-lg leading-relaxed text-tnb01-ink/65">Narrow the window past <code class="rounded bg-white/10 px-1.5 py-0.5 text-[0.9em]">md</code> and the same bar becomes the hamburger layout — one navbar, two class lists. Scroll: the bar stays, and <code class="rounded bg-white/10 px-1.5 py-0.5 text-[0.9em]">backdrop-blur-xl</code> blurs the gradient behind it.</p>
    <div class="mt-10 grid gap-4 sm:grid-cols-3">
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">Translucent fill first — blur over opaque paint is a no-op.</div>
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">State lives on the element: <code>group-has-checked:</code>, not a sibling chain.</div>
      <div class="rounded-2xl border border-white/10 bg-white/5 p-5 text-sm text-tnb01-ink/70">44px rows on mobile, declared as <code>min-h-11</code>.</div>
    </div>
  </main>
</div>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-tnb01-bg1: #14102b;
  --color-tnb01-bg1: oklch(0.22 0.06 285);
  --color-tnb01-bg2: #241a4d;
  --color-tnb01-bg2: oklch(0.3 0.09 288);
  --color-tnb01-ink: #f0eeff;
  --color-tnb01-ink: oklch(0.95 0.02 290);
  --color-tnb01-acc: #a78bfa;
  --color-tnb01-acc: oklch(0.74 0.15 295);
  --color-tnb01-acc2: #60a5fa;
  --color-tnb01-acc2: oklch(0.73 0.14 255);
  --font-tnb01-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's
   w-full min-h-svh, so the stage is sized before the browser build compiles. */

.tnb-01 {
  width: 100%;
  min-height: 100svh;
}

.tnb-01 ::selection {
  background: var(--color-tnb01-acc);
  color: #14102b;
}
```

How this works

The glass is two utilities. backdrop-filter does nothing over an opaque background, so the bar keeps a translucent fill and the blur reads whatever scrolls beneath it:

class="sticky top-0 border-b border-white/15 bg-white/8
  backdrop-blur-xl backdrop-saturate-150"

The checkbox hack becomes a variant. The input is sr-only inside the group root, and every element that reacts to it says so on itself: group-has-checked:rotate-45 on the top hamburger bar, group-has-checked:opacity-0 on the middle, group-has-checked:grid on the panel. No sibling chain, no dependence on DOM order.

One bar, two layouts. The desktop links are hidden md:flex; the hamburger is md:hidden; the panel is md:hidden and collapsed by default. The mobile navbar is not a second navbar.

Make it yours

  • Blur weight: backdrop-blur-xl → backdrop-blur-3xl for heavier frosting over busy hero imagery.
  • Recolour through --color-tnb01-acc in @theme — hover pills, the active dot and the gradient CTA all read it.
  • Bar height: h-16 on the bar. Nothing inside is height-locked, so one change is enough.
  • Denser glass on scroll: add data-scrolled from a 3-line listener and pair it with data-scrolled:bg-white/15.

Gotchas — read before shipping

  • backdrop-blur-* is inert over an opaque background — keep the bg-white/8 fill, or the blur silently does nothing.
  • A sticky bar does not stick if any ancestor has overflow-hidden or overflow-auto; the demo root deliberately sets neither.
  • group-has-checked: needs group on the common ancestor of the input and the target — on the section root here, not on the bar.
  • The label must carry the input's id in for; a div with a click handler is not a keyboard-reachable toggle.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

backdrop-filter is Baseline; the floor quoted is Tailwind v4's generated sheet. The supports-[backdrop-filter] fallback keeps the bar readable without it.

Techniques used in this demo

Theme tokensset in @theme, used by a utility

Search CodeFronts

Loading…