0

I want to apply a blurred background effect to a text. So I have this:

CSS

background: rgba(255,255,255,0.8);
-webkit-background-clip: text;
color: transparent;
backdrop-filter: blur(15px);

HTML

<h3>this is a text</h3>`

However when backdrop-filter is applied that blur applied to the entire H3 container not just the clipped text. Why is that?

Sandro Antonucci
  • 1,683
  • 5
  • 29
  • 59

1 Answers1

0

The backdrop is NOT the background. As example:

body {
  padding: 50px;
  background: url(https://images.unsplash.com/photo-1553532434-5ab5b6b84993?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1267&q=80) no-repeat 50% 50% /cover;
}

.test {
  width: 52px;
  height: 52px;
  background: url(https://img.icons8.com/material/24/ffffff/home--v5.png) no-repeat 50% 50%;
  border: 2px solid #fff;
  margin: 0 auto;
  
  backdrop-filter: blur(15px);
}
<div class="test"></div>

Here you can see what backdrop-filter is applied only to backdrop of .test (underlying elements). It is not applying to background (you can see what house icon created with background stayed unblurred)

So, when you are attempting to use background-clip it clips only background (which is transparent). Backdrop is left as-is.


If you want glassy text you could look at this question.

Home icon by Icons8

ISD
  • 984
  • 1
  • 6
  • 21