Neon color spreading optical illusion designed in pure CSS, blending repeating concentric radial patterns to perceive a central glowing lime ring.

Neon Color Spreading CSS Optical Illusion

An elegant pure-CSS demonstration of the neon color spreading optical illusion. Operating with zero HTML markup, the stylesheet overlays concentric repeating radial ring quadrants and a central green circle, combining them via background-blend-mode: lighten. This causes the green pigment to visually bleed into the black gaps, tricking the brain into perceiving a glowing lime-colored sphere.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 35+ Edge Edge 79+ Firefox Firefox 30+ Safari Safari 8+
Features:
Neon Color Spreading Background Blending Concentric Gradients
License: MIT
Interactive Café Wall optical illusion built entirely with pure CSS conic gradients, shifting row positions on hover to reveal parallel lines.

Pure CSS Café Wall Optical Illusion

An interactive pure-CSS representation of the classic Café Wall optical illusion. Built with zero HTML markup, the layout layers gray linear separators and offset black-and-white conic gradients to create a pattern where perfectly parallel lines appear tilted. Hovering over the page realigns the checkerboard columns to immediately debunk the cognitive illusion.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 69+ Edge Edge 79+ Firefox Firefox 83+ Safari Safari 12.1+
Features:
Optical Illusion Conic Gradients Zero-HTML Layout
License: MIT
Pure CSS Ehrenstein optical illusion featuring aligned linear segments that trick the brain into perceiving non-existent white circular discs.

Pure CSS Ehrenstein Optical Illusion

An elegant pure-CSS implementation of the classic Ehrenstein optical illusion. Requiring zero HTML, the stylesheet utilizes offset conic-gradient() coordinates to render a repeating grid of vertical and horizontal lines. When looking at the resulting pattern, the human visual system automatically completes the missing intersections, perceiving non-existent bright white discs.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 69+ Edge Edge 79+ Firefox Firefox 83+ Safari Safari 12.1+
Features:
Optical Illusion Conic Gradients Zero-HTML Layout
License: MIT
Kanizsa Square optical illusion created with pure CSS conic gradients, rendering subjective white contour boundaries without drawn lines.

Pure CSS Kanizsa Square Optical Illusion

An elegant pure-CSS implementation of the classic Kanizsa Square optical illusion. Requiring zero HTML, the layout combines layered conic and radial gradients inside a single pseudo-element to render four black ‘Pacman’ circles. This arrangement triggers a Gestalt perception where the brain automatically draws subjective white boundary contours to construct a floating foreground square.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 69+ Edge Edge 79+ Firefox Firefox 83+ Safari Safari 12.1+
Features:
Kanizsa Square Subjective Contours CSS Masking
License: MIT
Interactive Simultaneous Contrast optical illusion made in CSS, using mix-blend-modes and background collapsing to show identical color values.

Simultaneous Contrast CSS Optical Illusion

An interactive pure-CSS representation of Adelson’s simultaneous contrast optical illusion. Built with zero HTML, the layout implements contrasting mix-blend-mode properties (darken and lighten) over a repeating black-and-white striped background. This makes two identical green squares appear as completely different shades until a hover gesture collapses the stripes to reveal they are the exact same color.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 41+ Edge Edge 79+ Firefox Firefox 32+ Safari Safari 8+
Features:
Contrast Illusion Blend Modes Zero-HTML Setup
License: MIT
Interactive demonstration of White's brightness illusion in pure CSS using mix-blend-modes to overlay identical gray columns on black and white stripes.

White's Brightness Contrast CSS Illusion

An elegant pure-CSS implementation of White’s brightness illusion. Operating with zero HTML markup, the stylesheet utilizes contrasting mix-blend-mode values (darken and lighten) to overlay identical solid gray columns over a repeating black-and-white horizontal striped background. This contextual setup tricks the visual system, making one gray bar appear perceptually darker than the other.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Jun 2026):
Chrome Chrome 41+ Edge Edge 79+ Firefox Firefox 32+ Safari Safari 8+
Features:
White's Illusion Blend Modes Zero-HTML Setup
License: MIT
Railway tracks fading into the distance with two identical yellow lines demonstrating the Ponzo optical illusion on hover

Perspective Railway Optical Illusion

This is a Perspective Railway Optical Illusion. It leverages CSS 3D transforms to create a vanishing point, tricking the human brain into perceiving two identical horizontal lines as different sizes (the Ponzo illusion). Its function is to provide an engaging, interactive visual puzzle for users, demonstrating the power of spatial context in UI design without external assets.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of May 2026):
Chrome Chrome 104+ Edge Edge 104+ Firefox Firefox 110+ Safari Safari 16.4+
Features:
Optical Illusion 3D Transforms Hover Reveal Single Div
License: MIT
Two sets of circles demonstrating the Ebbinghaus illusion, merging on hover to prove the central circles are identical in size

Ebbinghaus Illusion

This is a Pure CSS Ebbinghaus Optical Illusion. It uses mathematically sized radial gradients on a single element to trick the brain into perceiving two identical circles as different sizes. Its function is to provide an interactive, visual “gotcha” moment, demonstrating how relative scale affects human perception, revealed instantly via a smooth hover transition.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of May 2026):
Chrome Chrome 112+ Edge Edge 112+ Firefox Firefox 112+ Safari Safari 16.5+
Features:
Optical Illusion Hover Reveal Single Div Responsive
License: MIT

See the Pen Ebbinghaus Illusion.

Black and white optical illusion geometric pattern generated with pure CSS gradients

Optical Illusion CSS Background Pattern

This is an Optical Illusion CSS Background Pattern. It generates a complex, interlocking geometric tessellation using only mathematical gradient overlays. Its function is to provide a visually striking, lightweight background texture without requiring external image assets.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Mar 2026):
Chrome Chrome 69+ Edge Edge 79+ Firefox Firefox 83+ Safari Safari 12.1+
Features:
Pure CSS Gradient Overlays Minimal Footprint
License: MIT
Black and white optical illusion pattern featuring a central circle that appears to pulse against a striped background, created with pure CSS gradients

Pulsing Circle Optical Illusion

This is a Pulsing Circle Optical Illusion. It generates a static, high-contrast geometric pattern that exploits peripheral vision to create a false sense of motion. Its function is to serve as a lightweight, visually arresting background or artistic centerpiece using only a handful of CSS properties and zero JavaScript.

Technologies:
CSS
Difficulty: Beginner
Browser Support (as of Mar 2026):
Chrome Chrome 69+ Edge Edge 79+ Firefox Firefox 83+ Safari Safari 12.1+
Features:
Optical Illusion Pure CSS No Animation
License: MIT
Two colored boxes (yellow and blue) moving horizontally across a black and white striped background, demonstrating the stepping feet illusion.

Stepping Feet Optical Illusion

This is the Stepping Feet Optical Illusion. It demonstrates how high-contrast patterns interfere with human motion perception. Two colored blocks move at identical, constant speeds, yet appear to stagger and “step” like feet. A hover interaction removes the background grid to expose the mathematical reality of their parallel movement.

Technologies:
CSS
Difficulty: Intermediate
Browser Support (as of Mar 2026):
Chrome Chrome 105+ Edge Edge 105+ Firefox Firefox 121+ Safari Safari 16.4+
Features:
Pseudo-elements Keyframe Animation Linear Gradients
License: MIT

See the Pen Stepping Feet Optical Illusion.

Optical Illusion Effect with CSS

Optical Illusion Effect with CSS

A CSS-only pattern generator creating a grid of intersecting lines with dots at intersections. Four diagonal and axis-aligned linear-gradient layers plus one radial-gradient layer for dots, all sized to var(--sq). The line gradient uses a repeating pattern of 0–100% with variable thickness (var(--lt)).

Checkbox Illusion

Checkbox illusion with optical pattern. Repeating conic gradient background creates grid. Pseudo-elements with layered gradients and mix-blend-mode: difference shift position on toggle, creating 3D shape motion effect. clip-path forms diamond mask.

See the Pen Checkbox Illusion.

Frequently Asked Questions

What is the structural benefit of generating optical illusions using native CSS gradients and transforms over static image assets?

Using native stylesheet declarations like repeating-conic-gradient and 3D transforms ensures pixel-perfect vector rendering at any scale with virtually zero network payload. Furthermore, native DOM elements remain fully interactive, enabling developers to build hover-revealed alignment checks or toggle states that demonstrate the illusion dynamically to the user.

How do high-density repeating pattern illusions affect page rendering performance, and how is this optimized?

Complex, repetitive gradients (like Moiré pattern overlays) can trigger severe rasterization bottlenecks and main-thread lag during scroll events. To safeguard your INP score, declare contain: strict on the pattern wrapper to limit repaint propagation, and animate elements purely using compositor-accelerated properties like transform and opacity.

What accessibility (A11y) and user safety considerations are mandatory when publishing motion or geometric illusions?

Animated visual anomalies and high-frequency geometric grids can trigger vestibular discomfort, nausea, or even seizures. Developers must always isolate intensive animated illusions within a @media (prefers-reduced-motion: reduce) block to provide a static, non-distorting fallback that respects system-level accessibility settings.

How is the simultaneous brightness contrast illusion efficiently coded in modern CSS?

You can achieve this effect with a single DOM container by applying a linear background-image gradient that fades from white to black on the parent. Placing two identical child elements on opposite sides of the gradient, each styled with a solid background-color: oklch(0.5 0 0), fools the brain into perceiving them as completely different shades of gray.

What is the safest fallback strategy for legacy rendering engines that struggle with advanced blend modes or clip-path geometry?

Implement progressive enhancement by isolating advanced overlapping filters and clipping coordinates inside a @supports (mix-blend-mode: difference) check. If the browser lacks support for complex layout composition, gracefully degrade the interface to a flat, illustrative representation of the geometric puzzle.