Skip to content

Instantly share code, notes, and snippets.

@andflett
Created March 19, 2026 10:27
Show Gist options
  • Select an option

  • Save andflett/d83e57ee37527bca6766699e00a9edff to your computer and use it in GitHub Desktop.

Select an option

Save andflett/d83e57ee37527bca6766699e00a9edff to your computer and use it in GitHub Desktop.
Glitching Text
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Glitch Text Effect</title>
<style>
body {
margin: 0;
display: grid;
place-items: center;
min-height: 100vh;
background: #09090b;
font-family: system-ui, sans-serif;
}
.glitch {
position: relative;
display: inline-block;
font-size: 4rem;
font-weight: 700;
color: white;
}
.glitch::before,
.glitch::after {
content: attr(data-text);
position: absolute;
inset: 0;
color: white;
background: #09090b;
overflow: hidden;
pointer-events: none;
}
.glitch::after {
left: 2px;
text-shadow: -1px 0 rgba(239, 68, 68, 0.7);
animation: glitch 4s infinite linear;
}
@keyframes glitch {
0% { clip-path: inset(25% 0 53% 0); }
6% { clip-path: inset(9% 0 74% 0); }
12% { clip-path: inset(64% 0 15% 0); }
18% { clip-path: inset(87% 0 2% 0); }
25% { clip-path: inset(55% 0 23% 0); }
31% { clip-path: inset(60% 0 61% 0); }
37% { clip-path: inset(68% 0 12% 0); }
43% { clip-path: inset(51% 0 27% 0); }
50% { clip-path: inset(100% 0 0% 0); }
100% { clip-path: inset(100% 0 0% 0); }
}
</style>
</head>
<body>
<span class="glitch" data-text="Glitchin">Glitchin</span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment