The backdrop-filter property allows us to apply filter effects to the content behind an element using CSS.

This property is an extension to the Filter Effects Module Level 1 that defines the filter property. It uses the same syntax as the filter property except that the effects are applied to the backdrop of the element instead. Such effects are commonly seen in the interfaces for devices running iOS7 and above, as well as OS X Yosemite and above. Without this property, this effect could only be achieved by editing the background image itself, then applying clipping and positioning techniques to achieve the desired effect.

For the property to have any visible effect, there needs to be 2 elements stacked on top of each other along the z-axis, from either nested elements or absolute positioning. And the background of the element which backdrop-filter is applied needs to be semi-transparent. backdrop-filter works by making the browser engine target the content behind the styled element, and not the background of the element itself. The filter effect is then applied to that content, and the backdrop is composited with other elements on the page in the final rendering.

Applying backdrop-filter to an element also creates a new stacking context, just like when opacity is applied.

Note that use of this property does have an adverse effect on performance, especially when applied to a large number of elements or a large area of the page, and should be used with careful consideration.

Official Syntax

  • Syntax: backdrop-filter: none | <filter-function-list>
  • Initial: none
  • Applies To: All elements. In SVG, it applies to container elements without the defs element and all graphics elements
  • Animatable: Yes

Values

none
This is the initial value. No filter effect is applied to the backdrop.
<filter-function-list>
A space-separated list of filter functions, applied in the order in which they are declared. The following is the list of filter functions available, which are the same as those for the filter property.

Examples

The following is a simple example of using the backdrop-filter property to create a frosted glass effect. The markup is an image and a div containing the text for its caption.

<div class="container">
  <img src="https://ichef.bbci.co.uk/images/ic/976x549_b/p0121stm.jpg">
  <div class="caption">
    <h3>Morgana</h3>
    <p>played by Katie McGrath</p>
  </div>
</div>

The caption is absolutely positioned over the bottom of the image and the backdrop-filter applied to it.

.caption {
  padding: 0.5em 1em;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  backdrop-filter: blur(4px);
  background-color: rgba(255, 255, 255, 0.5);
}

The final effect should look like this: background-filter_eg

Live Demo

This property is currently only supported (and thus viewable) in Safari 9 onwards. It is possible to enable this CSS property on Chrome and Opera by enabling the ”Experimental Web Platform Features” flag.

The following demo is an example of how we can adjust the text colour depending on the background colour, i.e. have light text on a dark background and vice versa, by applying the inverse() filter to the text, then re-inverting the background behind the filter with backdrop-filter. https://jsfiddle.net/huijing/51wvdege/

This demo is an example of how we can create a night-mode effect toggle using the inverse() filter. https://jsfiddle.net/huijing/kz0jhkw6/

We can also make use of the blur() filter to create a graphic content toggle. https://jsfiddle.net/huijing/u5drtsu2/

Browser Support

[caniuse feature="css-backdrop-filter"]