-3

When I try to use blur effect it will be twitching my element slightly.

Can anyone help me to fix this problem?

$bg: rgba(0, 0, 0, 0.2);

*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.container {
  width: 85vw;
  margin: 1rem auto;
}


.bg,
.overlay {
  text-align: center;
}

img,
.overlay {
  transition: .3s all;
  border-radius: 3px;
}

.bg {
  float: left;
  max-width: 31%;
  position: relative;
  margin: .5%;
  img {
    width: 100%;
    margin-bottom: -4px;
  }
  .overlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background: $bg;
    color: #fff;
    opacity: 0;
    h2 {
      padding-top: 20%;
      font-family: 'Droid Serif', serif;
    }
    p {
      font-family: 'Julius Sans One', sans-serif;
    }
  }
  &:hover {
    .overlay {
      opacity: 1;
    }
    img {
      -webkit-filter: blur(2px);
      filter: blur(2px);
    }
  }
}

@media screen and (max-width: 1148px) {
  .bg {
    max-width: 48%;
    margin: 1%;
  }
}

@media screen and (max-width: 768px) {
  .bg {
    float: none;
    max-width: 80%;
    margin: 1% auto;
  }
}
<div class="container">
  <div class="bg">
    <img src="https://unsplash.it/400/200" alt="">
    <div class="overlay">
      <h2>Check This <span>Out!</span></h2>
      <p>this is some text.</p>
    </div>
  </div>
  <div class="bg">
    <img src="https://unsplash.it/400/200" alt="">
    <div class="overlay">
      <h2>Check This <span>Out!</span></h2>
      <p>this is some text.</p>
    </div>
  </div>
  <div class="bg">
    <img src="https://unsplash.it/400/200" alt="">
    <div class="overlay">
      <h2>Check This Out!</h2>
      <p>this is some text.</p>
    </div>
  </div>
</div>

Check Codepen link

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
  • 4
    Possible duplicate of [CSS transition effect makes image blurry / moves image 1px, in Chrome?](https://stackoverflow.com/questions/15464055/css-transition-effect-makes-image-blurry-moves-image-1px-in-chrome) – Andy Ray Jan 17 '18 at 05:34

1 Answers1

-4

p:hover{ -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); filter: blur(5px);}