DEV Community

Ahmod Musa
Ahmod Musa

Posted on β€’ Originally published at ahmodmusa.com

Build a Cyberpunk Glitch Effect with Pure CSS (No JS) πŸ€–

We all love that futuristic Cyberpunk 2077 aesthetic. The neon lights, the scanlines, and of courseβ€”the Glitch Effect.

Usually, developers rely on heavy JavaScript libraries (like GSAP or anime.js) to achieve this. But today, I want to show you how to do it with 100% Pure CSS.

Here is what we are building:

The Logic Behind the Glitch 🧠
To make this work without JavaScript, we use two simple tricks:

data-text Attribute: We pass the text string in HTML so CSS can access it via content: attr(data-text). This creates a "Ghost Layer" (duplicate text) without bloating the DOM.

clip-path: We use this to "slice" the ghost layer into random strips.

@keyframes: We animate the slice positions rapidly to create the jitter/glitch effect.

Here is the full, copy-paste ready code.

Top comments (0)