CSS propertyEffects

backdrop-filter

Applies a filter to what is visible behind an element, for example blurring the background behind a panel.

Initial value
none
Inherited
No
Animatable
yes, as a list of filter functions
Applies to
all elements
JavaScript
element.style.backdropFilter = "blur(12px)"
On this page

Example

#
CSS
.header {
  position: sticky;
  top: 0;
  background: rgb(10 10 10 / 0.6);
  backdrop-filter: blur(12px);
}
Preview

Definition and usage

#

The backdrop-filter property works like filter, but not on the element itself, rather on the area of the page visible through it. The most popular effect is β€œglass”: a semi-transparent panel with a blurred background underneath.

For the effect to be visible, the element needs an at least partly transparent background, for example background: rgb(0 0 0 / 0.4). A solid, opaque background will hide the filter.

Blurring the background is computationally expensive. On weaker devices, large panels with backdrop-filter can slow down scrolling, so use it for small elements such as headers and popups.

Syntax

#
Syntax
backdrop-filter: none | <filter-function>+;

Values

#

Values in practice

#

none

The background under the panel is sharp.
.demo { backdrop-filter: none; }

blur(10px)

A frosted glass effect.
.demo { backdrop-filter: blur(10px); }

grayscale(1)

The background under the panel in shades of grey.
.demo { backdrop-filter: grayscale(1); }

blur(8px) saturate(1.8)

A blur with boosted colours, like in system interfaces.
.demo { backdrop-filter: blur(8px) saturate(1.8); }

Browser support

#

Newly available Β· since 2024

Works in the current versions of all major browsers. Older versions may not support it.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Without a semi-transparent background the effect won’t be visible. Start with a colour at 40-70% opacity.
  • Older versions of Safari required the -webkit-backdrop-filter prefix.

Related entries

#

Practise it in lessons

#

Spotted a mistake or missing an example? Write to us.