Hover✨ Premium

Glitch Hover

Three CSS @keyframes on hover: glitchBase shakes the element, glitchRed and glitchCyan shift red and cyan copies using horizontal clip-path bands — RGB chromatic aberration with no JavaScript.

CSSGlitch

Updated

This effect is part of Effect.Labs — 840 vanilla effects, some free, some premium. Hover has 48 effects, including 5 free. Explore the category →

3 usage examples

Navigation links — cybersecurity tool with dark sidebar — Glitch Hover example 1

① Navigation links — cybersecurity tool with dark sidebar

WhenSidebar links (Dashboard, Threats, Network, Firewall, Reports) of the Vectum monitoring tool; on hover or focus, each link enters glitch mode — red and cyan chromatic aberration held continuously.
WhyThe glitch effect in a security tool reinforces thematic coherence: the interface 'reacts' as if it detected an anomaly. The animation draws the eye without leaving the dark aesthetic.
SettingsColumn links in a dark sidebar; monospace icons; green monochrome cybersecurity theme; glitch triggered on hover and held on focus via script.
Destructive action button — settings page with danger zone — Glitch Hover example 2

② Destructive action button — settings page with danger zone

When'Delete Account' button in the danger zone of the Nelvira settings page; on hover and focus, the red and cyan glitch visually warns of irreversibility.
WhyThe glitch on a destructive button turns the technical warning into a strong visual signal: chromatic aberration creates intentional friction that forces attention before the click.
SettingsMedium button in a dark burgundy danger section; warning text; red and cyan chromatic aberration on hover and focus.
Artist card — independent electronic music label — Glitch Hover example 3

③ Artist card — independent electronic music label

WhenArtist cards (VXRM, KORA, ZAEL, DRXN, SYNN, LURA) in the NOÏRA label roster grid; hovering each card triggers glitch — as if archive video signal breaks up.
WhyChromatic aberration on the thumbnails of an electronic label reinforces the underground visual identity: the effect is expected, consistent, and creates an atmosphere unique to the genre's aesthetic.
SettingsSquare card grid; artist name in caps; very dark background; glitch triggered on hover; industrial electronic aesthetic.

How it works

The .fx-0354-root root centers a .hover-box.hover-glitch block on a #0a0a0f background. The element carries a data-glitch-label attribute whose value is reused in content: attr(data-glitch-label) on the ::before (red) and ::after (cyan) pseudo-elements. These pseudo-elements are overlaid at 50% of the element via transform: translate(-50%, -50%) and have opacity: 0 at rest.

On hover (or focus), four animations start simultaneously: fx0354-glitchBase shakes the element by ±2 px in XY; fx0354-glitchRed moves the red copy while clipping it into variable horizontal bands with clip-path: inset(X% 0 Y%); fx0354-glitchCyan does the same in an offset pattern for the cyan copy; fx0354-glitchText slightly shifts the span. The effect creates visible RGB chromatic aberration in the shifting red and cyan bands.

Animation names are prefixed fx0354- to prevent collisions. Measured in Chromium 151: effect visible, two copies on a page — only the hovered one animates. Photosensitivity risk: the animation combines rapid motion and color flashing; under prefers-reduced-motion: reduce, all animations are disabled.

Accessibility

  • Reduced motion and photosensitivity: under prefers-reduced-motion: reduce, all animations (glitchBase, glitchRed, glitchCyan, glitchText) are disabled and the red and cyan copies stay invisible. No flashing or rapid motion under reduced motion. Photosensitive users should enable this system setting.
  • Keyboard: the element is a natively focusable <button>. The :focus-visible rule triggers the same Glitch animations as hover; an indigo outline marks the focus state.
  • Content: the text stays readable via the span (z-index 1) even during the animation. The red and cyan copies do not alter how screen readers read the text.
  • Touch: the first touch triggers the animation; it stops on the next touch. On touch screens, exposure to the animation may last longer — the photosensitivity note applies.

Browser compatibility

Pure CSS (@keyframes, clip-path: inset(), animation, :focus-visible, prefers-reduced-motion), no JavaScript. Measured in Chromium 151: full effect, two independent copies. clip-path: inset() available from Chrome 55, Firefox 54, Safari 10.

Chrome 55+✓ Full (measured)
Firefox 54+✓ Full
Safari 10+✓ Full
Edge 79+✓ Full (Chromium engine)
Mobile iOS 10+✓ Full
Android Chrome 55+✓ Full (Chromium engine)

Without clip-path (very old browsers), the red and cyan copies display whole without banding — the glitch is less readable but not broken. Without animation, the element stays static.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0354-root">
  <button class="hover-box hover-glitch" type="button" data-glitch-label="…">
    <span>…</span>
  </button>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
RGB copy text (HTML — data-glitch-label) The visible text in the span The value of data-glitch-label is used by the ::before and ::after pseudo-elements via content: attr(data-glitch-label). Changing the value changes the text in the chromatic copies.
Aberration colors (CSS — color of ::before and ::after) Red (red) and cyan (#0ff) Replace with #f97316 and #22d3ee for orange-cyan, or #a855f7 and #22c55e for violet-green.
Shift amplitude (CSS — the -52% and -48% in the keyframes) 2% offset Increasing to 4–5% makes the effect more pronounced; reducing to 1% makes it subtle. The sign of the values determines the shift direction.
Animation speed (CSS — animation: .3s ease 0s infinite) 300 ms per cycle .5s makes the glitch slower and less aggressive; .1s makes it very jittery. steps(1) as the easing creates a more jerky glitch.
Element background (CSS — background of .hover-glitch) var(--bg-card) (dark) A textured or gradient background makes the glitch harder to read but more organic. On a light background, replace the RGB copy colors with darker tones.

FAQ

Yes: the glitch combines rapid motion and frequent color changes. Under prefers-reduced-motion: reduce, all animations are disabled in the provided code. It is recommended to warn users in the interface if this effect is central to the page.
The data-glitch-label attribute is copied into the CSS pseudo-elements. If the span text changes dynamically, also update the attribute: el.setAttribute('data-glitch-label', newText).
The current effect glitches text by shifting colored copies. For an image, use ::before and ::after as overlaid layers with background-image, then apply clip-path and mix-blend-mode: color for the chromatic aberration.