alt.hn

1/22/2026 at 5:41:22 PM

CSS Optical Illusions

https://alvaromontoro.com/blog/68091/css-optical-illusions

by ulrischa

1/22/2026 at 8:14:24 PM

These "dots appearing only while (not) focused" are known as "extinction illusions", namely

    "25 - Appearing Dots"
is "McAnany's type" [1], and

    "26 - Disappearing Dots"
is known as "Ninio's type" [2], according Akiyoshi Kitaoka's materials. (I have recreated them too few years ago [3][4], before getting to the source.)

[1] https://www.psy.ritsumei.ac.jp/akitaoka/kieru3e.html#:~:text...

[2] https://www.psy.ritsumei.ac.jp/akitaoka/kieru3e.html#:~:text...

[3] https://codepen.io/myf/full/XjdmJy ( scintillation warning)

[4] https://codepen.io/myf/full/jMqoMW ( scintillation warning)

by myfonj

1/23/2026 at 10:34:24 AM

I thought this was going to go the other way.

Worked on a project that wanted to make everything a different grayscale color. It was out of control already when someone one day complained that two pieces of text were a different color.

They weren’t. They were identical. But they were on two different background colors which make the optical illusion that they weren’t. And I reminded them for the twentieth time that we were using too goddamned much gray.

by hinkley

1/23/2026 at 8:57:20 AM

This coca cola illusion is my favourite one https://gagadget.com/en/446542-a-photo-of-a-coca-cola-can-th...

Coca cola appears red when no red at all is used in whole image

by smusamashah

1/24/2026 at 3:53:27 AM

This is a great illusion, though I often see that people try to explain this (and a similar image of strawberries) as "our brain knows this object is supposed to be red so it fills in red", which is not what's happening - it's based on color contrast like many other optical illusions

by flexagoon

1/24/2026 at 3:43:27 PM

The background on the can is a very light red. I know from painting murals that a light color close up looks darker from some distance.

by mediumsmart

1/22/2026 at 6:29:47 PM

This is cool, but more as a demonstration of interesting CSS techniques than optical illusions in my opinion.

Also, interestingly, I seem to be able to force myself to "see through" all of these illusions except for induced gradients, which I can't stop seeing unless I cover part of the screen.

by sandpaper26

1/22/2026 at 6:36:03 PM

33 - color fan: There is another interesting optical illusion here: The fan seems to rotate faster when not directly looking at it.

by nilslindemann

1/23/2026 at 7:40:07 PM

On #4 (White's Illusion) it looks like for me that the gray bar that is surrounded by black is brighter than the one surrounded by white instead of darker :#

by andredurao

1/23/2026 at 5:26:12 AM

What would be most interesting is using optical illusions to help decode how brain visual processing is done.

by aj7

1/22/2026 at 6:27:27 PM

These are all super dark, for some reason.

by encom

1/22/2026 at 6:59:54 PM

You have to actually run them. Otherwise, they're just a dark CodePen preview.

by christophilus

1/22/2026 at 7:32:00 PM

Why the extra step of having to click each one? Only a few of them are interactive.

by encom

1/22/2026 at 8:00:52 PM

Because codepens can run javascript. And if a page has 50 of them, it might make the page load time much longer. I know that all these examples are pure CSS, and maybe there is a setting in codepen to disable the "Run" button and automatically run it. Still, getting to decide is generally a better pattern than presuming that that's what the user wants, especially when the fact that the code is inside a codepen makes it explicitly not an integral function of the page. "I thought this was just a blog, and now you want me to run all this javascript??" -- some JS hater, probably.

I appreciate getting to choose as much as possible when code runs.

by d-us-vb

1/22/2026 at 8:27:36 PM

Somewhat ironically, Codepen ended up introducing the JS execution requirement to view the content.

by zamadatix

1/22/2026 at 6:01:34 PM

Wow, this is great!

I want to put some of them in my UIs.

by moralestapia

1/22/2026 at 8:57:23 PM

I've often run into these unintentionally messing up my UIs!

by herpdyderp

1/22/2026 at 10:58:56 PM

Heh, I used to do these in Excel.

by layer8

1/22/2026 at 11:57:55 PM

They could make capchas out of these.

by eulgro

1/23/2026 at 8:03:55 PM

"Please select the dancers spinning to the right"

by hiccuphippo