htmlcsswebcss-filters

How to reduce backdrop filter from period of length


I want to smooth out the nav bar backdrop filter so it's less noticeable.

But how can I reduce the backdrop filter from 100% to 0% to the bottom.

Image of what I have now


Solution

  • Do you mean, something like this?

      <header class="header">
        <div class="wrapper">
          <a href="#" class="logo">Backdrop filter</a>
          <nav class="nav">
            <ul class="menu">
              <li class="menu__item"><a href="#" class="menu__link">Blur</a></li>
              <li class="menu__item"><a href="#" class="menu__link">Contrast</a></li>
              <li class="menu__item"><a href="#" class="menu__link">Grayscale</a></li>
              <li class="menu__item"><a href="#" class="menu__link">Saturate</a></li>
            </ul>
          </nav>
        </div>
      </header>
    
      <div class="banner">
      </div>
      <div class="banner img1">
      </div>
      <div class="banner img2">
      </div>
      <div class="banner">
      </div>
    
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }
    
    :root {
      --title-font:"Poppins", sans-serif;
      --body-font:"Poppins", sans-serif;
    }
    
    body {
      font-family: var(--body-font);
    }
    
    .header {
      width: 100%;
      background: rgba(0, 0, 0, 0.2);
      backdrop-filter: blur(20px);
      height: 54px;
      position: fixed;
      display: flex;
      align-items: center;
      border-bottom: 1px solid rgba(27, 33, 56, 0.1);
    }
    .header .wrapper {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 80%;
      margin: auto;
    }
    
    .logo {
      font-family: "Ubuntu";
      font-size: 1.3em;
      text-decoration: none;
      color: #fff;
      display: block;
    }
    
    .menu {
      list-style: none;
      display: flex;
    }
    .menu .menu__item {
      margin-right: 3em;
    }
    .menu .menu__item a {
      text-decoration: none;
      color: #fff;
      font-size: 0.8em;
      font-weight: 600;
    }
    
    .banner {
      height: 100vh;
      width: 100%;
      display: flex;
      align-items: center;
      background: url("https://images.pexels.com/photos/192136/pexels-photo-192136.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260") center/cover;
      justify-content: center;
    }
    
    .img1 {
      background: url("https://images.pexels.com/photos/1029604/pexels-photo-1029604.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260") center/cover;
    }
    
    .img2 {
      background: url("https://images.pexels.com/photos/35188/child-childrens-baby-children-s.jpg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260") center/cover;
    }