Home > database >  I want to blur the back surface using filtering and make the middle part normal
I want to blur the back surface using filtering and make the middle part normal

Time:12-04

<style> 
.Parallax{
    width:100vw;
    height: 100vh;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.ImageLayer {
    width: 80%;
    height: 80%;
    backdrop-filter:blur(10px);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}       
</style>
          
<div  style="background-image: url('https://images.pexels.com/photos/2478248/pexels-photo-2478248.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1')">
     <div ></div>
</div>
        

The output of the code makes the middle part blurry, and I want to do the opposite.

I tried a few times but it didn't turn out the way I wanted. I wrote this code just as an example

CodePudding user response:

Perhaps you'll need another layer of image

.Parallax-blur {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-image: url('https://images.pexels.com/photos/2478248/pexels-photo-2478248.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1');
  filter: blur(10px);
  clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%);
}

.Parallax {
  position: absolute;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-image: url('https://images.pexels.com/photos/2478248/pexels-photo-2478248.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1');
  z-index: 1;
}

.ImageLayer {
  width: 80%;
  height: 80%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
<div >
  <div >
    <div ></div>
  </div>
</div>

For clip-path values, check here:

https://bennettfeely.com/clippy/

  • Related