<div class="center">
  <h1 class="glitch is-glitching" data-text="GLITCH EFFECT">GLITCH EFFECT</h1>
</div>
html, body {
  overflow: hidden;
  margin: 0;
  height: 100%;
}

.center {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100vw;
  height: 100vh;
  background: #000;
}

h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 9vw;
  text-transform: uppercase;
}

.glitch {
  position: relative;
  color: white;
  mix-blend-mode: lighten;

  &:before,
  &:after {
      content: attr(data-text);
      position: absolute;
      top: 0;
      width: 100%;
      background: black;
      clip: rect(0, 0, 0, 0);
  }
  
  &:before {
      left: -1px;
      text-shadow: 1px 0 rgba(red,0.7);
  }

  &:after {
      left: 1px;
      text-shadow: -1px 0 rgba(blue,0.7);
  }

  &.is-glitching {
    &:before {
      text-shadow: 4px 0 rgba(red,0.7);
      animation: glitch-1 0.8s infinite ease-in-out alternate-reverse;
    }
    &:after {
      text-shadow: -5px 0 rgba(blue,0.7);
      animation: glitch-2 0.8s infinite ease-in-out alternate-reverse;
    }
  }
}

@keyframes glitch-1 {
  0% { clip: rect(36px, 9999px, 9px, 0) }
  25% { clip: rect(25px, 9999px, 99px, 0) }
  50% { clip: rect(50px, 9999px, 102px, 0) }
  75% { clip: rect(30px, 9999px, 92px, 0) }
  100% { clip: rect(91px, 9999px, 98px, 0) }
}

@keyframes glitch-2 {
  0% { top: -1px; left: 1px; clip: rect(65px, 9999px, 119px, 0) }
  25% { top: -6px; left: 4px; clip: rect(79px, 9999px, 19px, 0) }
  50% { top: -3px; left: 2px; clip: rect(68px, 9999px, 11px, 0) }
  75% { top: 0px; left: -4px; clip: rect(95px, 9999px, 53px, 0) }
  100% { top: -1px; left: -1px; clip: rect(31px, 9999px, 149px, 0) }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.