GlassmorphismPremium

Glass Navigation

A glass navigation bar that floats over the backdrop: 16 px blur, pill links that light up on hover and on keyboard focus, current page in purple. CSS only.

CSSNavHover

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Glassmorphism has 47 effects, including 6 free. Explore the category →

3 usage examples

Floating menu over the main visual — an art glassworks website — Glass Navigation example 1

① Floating menu over the main visual — an art glassworks website

WhenHome page of a glass-blowing studio: coloured globes hang from the ceiling, three vases stand on a shelf, and the site menu floats above them 28 px from the top of the page.
WhyThe globes pass behind the bar and dissolve into it: the menu stays readable without losing the visual, and a glass menu echoes the craft on show. The five entries are real links; the current page, “Workshop”, wears the pill, amber here.
SettingsEffect scene enlarged to 540 × 302 px, its gradient replaced by the set; orbs recoloured amber #f59e0b and teal #0e7490; links as 12 px <a href> with a 6 px gap; active pill recoloured to rgba(245,158,11,.28); brand in spaced serif.
Tab bar at the bottom of the screen — an electric-car charging point app — Glass Navigation example 2

② Tab bar at the bottom of the screen — an electric-car charging point app

WhenA driver is looking for a free charging point: the map fills the screen, and the glass bar at the bottom leads to trips, saved points, the map, charging history and the account.
WhyAn opaque bar would cut off the bottom of the map; in glass, it lets the streets and pins show faintly underneath. The active tab reads at a glance thanks to the pill, turned green like the free charging points.
SettingsBar moved to the bottom (top: auto; bottom: 72px), 316 × 56 px, 18 px corners, no brand; five 60 × 46 px buttons with an SVG icon above the label; a small scene script moves .glass-nav-link--active and aria-current to the tapped tab and swaps the panel — the effect itself has no script.
Playback speed of a filmed lesson — an online pastry school's player — Glass Navigation example 3

③ Playback speed of a filmed lesson — an online pastry school's player

WhenA student is following the pastry-cream lesson and wants to slow down the whisking: a small glass selector above the progress bar offers 0.75×, 1×, 1.5× and 2×.
WhyHere the bar is no longer a menu but a setting: the brand becomes the “Speed” label, the links become four segments, and the active pill tells the current speed. The glass lets the filmed saucepan show through.
Settings300 × 52 px bar set 228 px from the top; 50 × 40 px segments as <button aria-pressed>; active pill in yellow rgba(252,211,77,.26); the scene script moves the active class, updates the “Speed” tag and slows the whisk in the set — none of that comes from the code you buy.

How it works

The bar is a <nav class="glass-nav-bar">, 48 px tall, absolutely positioned 20 px from the top and from both sides of .glass-nav-scene: it touches no edge, hence the look of a floating pill. Its glass takes four declarations — 8% white, backdrop-filter: blur(16px), a 10% white border, 12 px corners. Behind it, the demo scene (360 × 200 px, plum to midnight-blue gradient) carries two .glass-nav-bg-orb orbs, a 200 px purple one and a 150 px cyan one, blurred at 50 px: they are what tints the glass.

The brand sits on the left (.glass-nav-logo, weight 800), three <button class="glass-nav-link"> on the right, 12 px in 70% white. On hover a link turns full white on a 10% white pill with 8 px corners, in 0.3 s. Keyboard focus gives exactly the same state, ringed by a 2 px lavender outline. The entry for the current page carries .glass-nav-link--active — a 30% purple pill with a 40% edge — and aria-current="page".

There is not one line of JavaScript: the active class is written in the HTML, by your template or your router, and nothing moves it on click. The bar does not react to scrolling either, and the code ships no collapsed menu for small screens: at 320 px wide the brand and the three links still fit inside the bar, but they touch. The links can be <a href> elements with no CSS change — the underline is already removed.

Accessibility

  • Keyboard: measured in Chromium, Firefox and WebKit, Tab moves focus to each link, which takes the hover pill plus a #c4b5fd outline offset by 2 px. In Safari, Tab only stops on buttons and links when “Press Tab to highlight each item” is ticked; otherwise use Option + Tab.
  • What Enter and Space do: they activate the <button>, but the code you buy attaches no action to it. To go from page to page, swap the buttons for <a href>; keep buttons only when a script of yours changes the view without leaving the page.
  • Screen readers: the bar is a real <nav> named by aria-label (“Main navigation”) and the active entry is announced thanks to aria-current="page". If you move the active class, move the attribute with it.
  • Touch: there is no hover on a touch screen. Measured in mobile emulation, the tapped link keeps its white pill until the next tap — harmless when it leads to another page. Links are 28 px tall: raise their padding to 12 px to get close to the advised 44 px.
  • Contrast, measured on the bar's real background: resting links between 4.8:1 (over the purple orb) and 8.0:1; hovered or active link between 8.0:1 and 14.8:1. Over a bright photo the 8% white veil no longer protects the text: darken the glass. Nothing moves continuously, only the colour changes in 0.3 s.

Browser compatibility

Three engines measured under Playwright (Chromium, Firefox, WebKit): same computed values for the glass (blur(16px)), hover and focus; the frosting itself could only be looked at in Chromium (the scenes on this page): automated captures of Firefox and WebKit do not paint it, even on a minimal test block. Real Safari: not verified. Minimum versions from MDN: backdrop-filter since Chrome 76, Edge 79, Firefox 103; Safari reads it from version 9 as -webkit-backdrop-filter, which the code also declares, and unprefixed from 18. :focus-visible lands with Chrome 86 and Safari 15.4; its rule is written apart from the hover rule, so an older browser keeps the hover and its default focus ring.

Chrome 76+✓ Full (measured) — focus style from version 86
Firefox 103+✓ States measured; frosting cannot be checked in automated captures
Safari 9+✓ Not verified on a real Safari — -webkit- prefix present, focus style from 15.4
Edge 79+✓ Not verified (same engine as Chrome)
Mobile iOS 9+✓ Not verified — the hover pill stays after a tap
Android Chrome 76+✓ Measured in touch emulation: the pill stays after a tap

Without backdrop-filter the bar stays an 8% white veil with a hairline border: the backdrop is no longer frosted but the links, their hover and the active pill work as they are. If that backdrop is a sharp photo, give the bar a denser fill inside @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))), for instance rgba(20, 18, 40, .72).

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0303-root">
  <div class="glass-nav-scene">
    <div class="glass-nav-bg-orb glass-nav-bg-orb--1"></div>
    <div class="glass-nav-bg-orb glass-nav-bg-orb--2"></div>
    <nav class="glass-nav-bar" aria-label="…">
      <span class="glass-nav-logo">…</span>
      <div class="glass-nav-links">
        <button type="button" class="glass-nav-link glass-nav-link--active" aria-current="page">…</button>
        <button type="button" class="glass-nav-link">…</button>
        <button type="button" class="glass-nav-link">…</button>
      </div>
    </nav>
    <div class="glass-nav-content">
      <h4>…</h4>
      <p>…</p>
    </div>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Glass of the bar (CSS — .glass-nav-bar { background; backdrop-filter }) 8% white, 16 px blur, 10% white border Change the blur value on both lines, -webkit-backdrop-filter and backdrop-filter. 24 px drowns a photo completely; 8 px keeps shapes recognisable. Over a bright backdrop, swap the white for a dark fill, rgba(15, 15, 30, .45).
Place and shape (CSS — top / left / right: 20px, height: 48px, border-radius: 12px) 20 px off the edges, 48 px tall, 12 px corners top: auto; bottom: 20px makes it a tab bar; border-radius: 999px a capsule; left: 0; right: 0; top: 0; border-radius: 0 a full-width bar. The bar is placed relative to .glass-nav-scene, which must stay position: relative.
Current page (CSS — .glass-nav-link--active) fill rgba(139,92,246,.3), border rgba(139,92,246,.4) Put your brand colour in those two values. One entry only carries the class, together with aria-current="page"; each page's HTML decides which.
Hover and focus (CSS — .glass-nav-link:hover, :focus-visible, transition: .3s) white text, 10% white pill, 2 px #c4b5fd outline for the keyboard The two rules are separate: edit them together to keep the same state for mouse and keyboard. Do not remove the outline, it is the only focus cue on the glass.
Links (HTML — <button> or <a href>, CSS padding: 6px 12px, font-size: .75rem) three 12 px buttons, 28 px tall Add or remove entries freely: the bar right-aligns them 4 px apart. Past four or five links under 400 px wide, plan your own collapsed menu — the code does not provide one.
Backdrop (CSS — .glass-nav-scene, .glass-nav-bg-orb--1, --2) 360 × 200 px scene, purple #7c3aed and cyan #0891b2 orbs blurred at 50 px The orbs are only there to colour the demo's glass. On your page, delete them and set the bar over your own image or video; size the scene to your header.

FAQ

Frosted Glass Navbar is a bar stuck to the top of a scrolling area: a script thickens its glass after 10 px of scroll, and its entries are plain spans. Glass Navigation has no script and its blur never changes; it floats clear of the edges and takes care of what the other leaves out: real buttons reachable by keyboard, a hover state, a focus state, a current page announced to screen readers. Pick Frosted Glass Navbar for a header that must react to scrolling, Glass Navigation for a menu, a tab bar or a selector you can drop anywhere.
It does not move by itself: the glass-nav-link--active class is written in the HTML. On a classic site, each page renders its menu with the class on its own entry. In a single-page app three lines are enough: on click, take the class and aria-current off the old link and put them on the new one — which is what the tab bar and the speed selector in the examples do.
Yes, but that is not the original setting: the bar is position: absolute inside its scene and leaves with it. Take the <nav> out of the scene and switch it to position: fixed (or sticky inside your header), with a z-index above the content. The blur then applies to everything scrolling underneath. Reserve the bar's height plus its 20 px margin at the top of the page, or it will cover your first heading.