Test365i
365i.co.uk
Back to all guides
CSS

Frosted glass panels inside a frosted header

A frosted header with frosted dropdown panels needs backdrop-filter in two places, and where you put the first one decides whether the second works. This guide builds both the way the Test365i mega menu does, with the header blur on a pseudo-element so the panels can frost the page behind them.

15 minutesCustom code

Works on WordPress 7.2, Elementor 4.4.2 and Elementor Pro 4.4.2; backdrop-filter in every current browser

Editorial integrity: read our editorial standards.

Live demo, running the code from this guide on a bare page with no theme styles.
  1. Give the sticky header a see-through background

    Start with a sticky header and a semi-transparent background, 55% of the page colour here. There is no blur on the header itself, and that is deliberate: the next step puts it somewhere the panels cannot trip over.

    A sticky header with a 55 percent background and no blur yet, so the panels can still blur
    Step 1 adds transparency only; the blur comes in step 2.
    frosted-header.cssCSS
    .site-header {
    	position: sticky;
    	top: 0;
    	z-index: 10;
    	background: rgba(8, 8, 19, 0.55);
    }
  2. Move the header's backdrop-filter onto ::before

    An element with backdrop-filter becomes what the specification calls a Backdrop Root: any backdrop filter on an element inside it can only see as far back as that root. Put the blur on the header and a dropdown panel inside it can only frost the header, so the page shows through sharp.

    The fix is to give the blur to a pseudo-element. ::before fills the header with inset: 0, sits behind the content with z-index: -1, and carries the backdrop-filter. The header element itself has no filter, so it is not a Backdrop Root.

    I found this building the mega menu on this site: the panels came out sharp until the header blur moved to ::before, and nothing else changed.

    With backdrop-filter on the header, the panel inside leaves the page sharp; with it on header::before, the panel frosts the page
    Rendered live by the browser: the only difference is where the header blur lives.
    frosted-header.cssCSS
    .site-header::before {
    	content: "";
    	position: absolute;
    	inset: 0;
    	z-index: -1;
    	pointer-events: none;
    	-webkit-backdrop-filter: blur(14px);
    	backdrop-filter: blur(14px);
    }
    After step 2: the header frosts the stripes behind it, but the panel has no blur of its own yet.

    MDN says it in one line on the backdrop-filter reference:

    Content above the backdrop root is not affected.

    MDN Web Docs, backdrop-filter reference

    "Above" means further back in the stacking order, which is everything behind the header: the page. The filter on the header is what makes the header a root in the first place, so moving it to ::before removes the root without losing the frosted look.

  3. Frost the panel with its own backdrop-filter

    Now the panel can have a stronger blur and a little extra saturation, and it reaches the page because nothing between them is a Backdrop Root. The values are the ones on the Test365i mega menu: 14px on the header, 28px with 140% saturation on the panels.

    Keep the panel background translucent, around 45%, or the frost disappears behind solid colour. The "Glass over light" frame in the Elementor 4 element gallery shows the same panel over the aurora.

    frosted-header.cssCSS
    .menu-panel {
    	position: absolute;
    	top: 100%;
    	left: 16px;
    	right: 16px;
    	border-radius: 18px;
    	border: 1px solid rgba(255, 255, 255, 0.14);
    	background: rgba(19, 19, 34, 0.45);
    	-webkit-backdrop-filter: blur(28px) saturate(140%);
    	backdrop-filter: blur(28px) saturate(140%);
    }
    After step 3: the panel frosts the page behind it as well, a heavier blur than the header.

    Josh W. Comeau points out a related limit that shapes how the panel looks:

    The backdrop-filter algorithm only considers the pixels that are directly behind the element.

    Josh W. Comeau, Next-level frosted glass with backdrop-filter

    That is why a panel over a plain dark area looks flat however strong the blur: there is nothing colourful directly behind it to frost. On this site the panels sit over the aurora light and page content, which gives the blur something to work with.

  4. Apply it to an Elementor 4 header

    In the Elementor Theme Builder header, give the outer container a class such as site-header and each dropdown container a class such as menu-panel. Elementor 4's style panel cannot target ::before, so the three rules above go in a Custom Code snippet (Elementor > Custom Code). That is where this site keeps them.

    The animated CSS mega menu guide builds the full menu around this. The structure outside Elementor is a header with the panel inside it:

    A site-header container holding the menu and a menu-panel container
    The classes go on the containers; the ::before rules go in Custom Code.
    index.htmlHTML
    <header class="site-header">
    	<nav>Your menu</nav>
    	<div class="menu-panel">Panel content</div>
    </header>

What backdrop-filter does not do here

Other properties make an element a Backdrop Root too, including filter, opacity below 1 and mask. If a panel still looks sharp, check its ancestors for those.

Large blurs cost painting work, especially while a sticky header scrolls. Two layers like these are fine; a blur on every card is not.

The panel background must stay translucent. A solid background hides the frost completely.

All the frosted header and panel code

Each file below is complete. Copy it, or download it under the name shown.

frosted-header.cssCSS
.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	background: rgba(8, 8, 19, 0.55);
}

.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
}

.menu-panel {
	position: absolute;
	top: 100%;
	left: 16px;
	right: 16px;
	border-radius: 18px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(19, 19, 34, 0.45);
	-webkit-backdrop-filter: blur(28px) saturate(140%);
	backdrop-filter: blur(28px) saturate(140%);
}
index.htmlHTML
<header class="site-header">
	<nav>Your menu</nav>
	<div class="menu-panel">Panel content</div>
</header>

backdrop-filter questions

Why does my frosted dropdown look sharp inside a frosted header?

The header has backdrop-filter, which makes it a Backdrop Root, so the dropdown can only blur the header. Move the header blur to ::before.

What is a Backdrop Root?

An element whose backdrop-filter, filter, opacity or mask limits how far back the backdrop filters of its descendants can see.

Do I need the -webkit- prefix?

It does no harm and covers older Safari versions, so this guide keeps it next to the standard property.

Does backdrop-filter hurt performance?

It adds painting work. A header and its panels are fine; blurring many large elements at once is not.

Can I do this in Elementor without Custom Code?

Not fully. The panel blur can sit in a class, but the header blur needs ::before, which the Elementor 4 style panel cannot target. Appearance > Customize > Additional CSS works instead of Custom Code.

Why is the panel blur stronger than the header blur?

The panel covers more of the page and holds text, so a heavier blur keeps the text readable over busy content.

Can I add a glow under the panel?

Yes. A soft coloured box-shadow lifts it off the page. Box Shadow Generator, made by Mark McNeece of 365i, builds one you can copy.

Sources

  1. MDN Web Docs: backdrop-filter
  2. CSS Working Group: Filter Effects Module Level 2, Backdrop Root
  3. Josh W. Comeau: Next-level frosted glass with backdrop-filter

More build guides

The latest guides, newest first.

Elementor

A clickable card grid with the Elementor 4 Collection loop

The Elementor 4 Collection loop repeats one design for every post a query finds. On this site it lists the build guides, which are a JetEngine post type, in the element gallery, the Lab and the mega menu, all from one card component. This guide builds that grid, makes each whole card clickable and hides fields that come back empty.

25 minutes Get the guide
Elementor

Style the Elementor 4 Carousel element: arrows, dots and loop

The Elementor 4 Carousel element gives you slides, arrows and dots as separate atomic parts. Out of the box on this site, the arrows sat on top of the slide titles, the active dot was black on a dark panel and Loop did nothing. This guide fixes all three, with the CSS the element gallery now runs.

20 minutes Get the guide
Elementor

The Elementor 4 Accordion element, built on native details

The Elementor 4 Accordion element is built on the browser's own details and summary elements, so it opens and closes with no script. This guide sets it up the way the element gallery on this site does, styles it with classes, and explains the FAQ schema switch and what Google now does with it.

15 minutes Get the guide