Backdrop filters: filter functions, but on what sits behind

backdrop-filter accepts the same functions as the familiar filter property — blur(), brightness() and the rest. The distinction lies in what gets affected: filter transforms the element itself, while a backdrop filter transforms the area behind it. For the effect to appear at all, the element needs a transparent or translucent background.

Keeping that requirement in mind guides three decisions: how the design should look, how filters stack across layered elements, and how they combine with other CSS effects.

Choosing a backdrop worth filtering

A blur applied over a flat, plain surface often looks underwhelming — not necessarily because the filter is wrong, but because there is nothing interesting behind it. Filters such as brightness(), contrast() and invert() can make a dull backdrop more lively by shifting its luminosity and hue. Distorting filters like blur() and opacity(), on the other hand, pair well with textured backdrops.

<main>
<div>
  <section>
    <h1>Weather today</h1>
    Cloudy with a chance of meatballs. Ramenstorms at 3PM that will last for ten minutes.
  </section>
</div>
</main>
main {
  background: center/cover url("image.jpg");
  box-shadow: 0 0 10px rgba(154 201 255 / 0.6);
  /* etc. */
  
  div {
    backdrop-filter: blur(10px);
    color: white;
    /* etc. */
  }
}

Stacking filtered layers

When several elements with backdrop filters sit on top of one another, every element except the bottommost one needs a translucent — not fully transparent — background. The bottom element can be either transparent or translucent, as long as there is a backdrop behind it. Skip this and the intended buildup of filter effects never materializes.

<main>
<div>
  <section>
    <h1>Weather today</h1>
    Cloudy with a chance of meatballs. Ramenstorms at 3PM that will last for ten minutes.
  </section>
  <p>view details</p>
</div>
</main>
main {
  background: center/cover url("image.jpg");
  box-shadow: 0 0 10px rgba(154 201 255 / 0.6);
  /* etc. */

  div {
    background: rgb(255 255 255 / .1);
    backdrop-filter: blur(10px);
    /* etc. */

    p {
      backdrop-filter: brightness(0) contrast(10);
      /* etc. */
    }
  }
}

Pairing with effects that share a backdrop root

An element gains a backdrop root (the name is not yet standardized) once it meets certain criteria, one of which is having a filter effect applied through filter or backdrop-filter. Effects that also rely on a backdrop root affect that same backdrop, so they tend to combine naturally with backdrop filters. Two worth trying are mask and mix-blend-mode.

In testing across major browsers, backdrop-filter combined with mask proved the most dependable result. With mix-blend-mode, the blur backdrop filter was lost, so that pairing is left out of the examples here, though it remains worth exploring.

Mask alongside a backdrop filter

CSS mask behaves differently from backdrop-filter: it affects both the background and the foreground (the descendants) of an element. That difference can be turned into an advantage, and worked around where it is unwanted.

<main>
  <div>
    <div class="bg"></div>
    <section>
     <h1>Weather today</h1>
      Cloudy with a chance of meatballs. Ramenstorms at 3PM that will last for ten minutes. 
    </section>
  </div>
</main>
main {
  background: center/cover url("image.jpg");
  box-shadow: 0 0 10px rgba(154 201 255 / 0.6);
  /* etc. */
  
  > div {
      .bg {
        backdrop-filter: blur(10px);
        mask-image: repeating-linear-gradient(90deg, transparent, transparent 2px, white 2px, white 10px);
        /* etc. */
      }
    /* etc. */
  }
}

Filters on foreground content

To apply a graphical effect to an element and everything inside it, filter is the tool — no backdrop filter needed. The exception: when a filtered foreground must contain elements that should stay unaffected, reach for a backdrop filter instead. In the demo below, hover over the blurred photo.

<main>
  <div class="photo">
    <div class="filter"></div>
  </div>
  <!-- etc. -->
</main>
.photo {
  background: center/cover url("photo.jpg");

  .filter {
    backdrop-filter: blur(10px) brightness(110%);
    mask-image: radial-gradient(white 5px, transparent 6px);
    mask-size: 10px 10px;
    transition: backdrop-filter .3s linear;
    /* etc.*/
  }

  &:hover .filter {
    backdrop-filter: none;
    mask-image: none;
  }
}

Recap

The scope for these techniques is broad. Stack filter effects across multiple elements by making every upper layer translucent, and combine them with other CSS features that operate on an element's backdrop. A custom effect worth the effort likely follows the same rules.