<a class="t-glitch" data-glitch="Glitch" href="#">Glitch</a>
.t-glitch {
position: relative;
text-decoration: none;
color: #fff;
}
.t-glitch:before,
.t-glitch:after {
content: attr(data-glitch);
display: block;
width: 100%;
position: absolute;
top: 0;
left: 0;
height: 100%;
opacity: 0.8;
}
.t-glitch:after {
color: #f0f;
z-index: -2;
animation: glitch .45s cubic-bezier(.25, .46, .45, .94) reverse both infinite
}
.t-glitch:before {
color: #0ff;
z-index: -1;
animation: glitch .35s cubic-bezier(.25, .46, .45, .94) both infinite
}
@keyframes glitch {
0% {
transform: translate(0);
}
20% {
transform: translate(1px, 1px);
}
40% {
transform: translate(-4px, 2px);
}
60% {
transform: translate(1px, 3px);
}
80% {
transform: translate(2px, -1px);
}
to {
transform: translate(0);
}
}
/* reset */
html {
display: flex;
height: 100%;
font-size: 400%;
line-height: 1;
color: #fff;
font-family: sans-serif;
}
body {
margin: auto;
background: purple;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.