Skip to content

Instantly share code, notes, and snippets.

@sudarshanReddykurri
Created September 13, 2016 13:34
Show Gist options
  • Save sudarshanReddykurri/faf4c57f0ffe7ea09e2345701e2b0d1e to your computer and use it in GitHub Desktop.
Save sudarshanReddykurri/faf4c57f0ffe7ea09e2345701e2b0d1e to your computer and use it in GitHub Desktop.
Simple Glitch Effect in Pure CSS
<a href="#" class="glitch">17</a>
body{
background-color: #000;
}
.glitch {
font-size: 130px;
line-height: 1;
font-family: 'Poppins', sans-serif;
font-weight: 700;
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
text-decoration: none;
color: #fff;
}
.glitch::before {
display: block;
content: '24';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .8;
color: #0ff;
z-index: -1;
}
.glitch::after {
display: block;
content: '24';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .8;
color: #f0f;
z-index: -2;
}
@keyframes glitch {
0% {
transform: translate(0)
}
20% {
transform: translate(-5px, 5px)
}
40% {
transform: translate(-5px, -5px)
}
60% {
transform: translate(5px, 5px)
}
80% {
transform: translate(5px, -5px)
}
to {
transform: translate(0)
}
}
.glitch:hover::before {
animation: glitch .3s cubic-bezier(.25, .46, .45, .94) both infinite
}
.glitch:hover::after {
animation: glitch .3s cubic-bezier(.25, .46, .45, .94) reverse both infinite
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment