1220 points · by mudkipdev · 1y ago · 140 comments
This immediately brought "A Single Div"[0] to mind, which stood as the coolest CSS demo I'd seen for... 11 years!
This one takes the cake. I'll be pouring over it. Thanks!
https://lynnandtonic.com/work/
Also love seeing Phoenix devs mentioned!
https://lynnandtonic.com/archive/
Got this bookmarked to click around for inspiration in my free time.
Some comments on this from my side:
- You people totally overwhelmed my website... I use(d) Firebase static hosting because it's completely free and super simple, which reached the 10 GB monthly limit now. I changed to Cloudflare in the meantime, but it'll need some time for the DNS records to update. IN THE MEANTIME, PLEASE USE THE GITHUB PAGES LINK INSTEAD: https://benjaminaster.github.io/CSS-Minecraft/
- I made this almost three years ago now, to try out the limits of what's possible with pure CSS, and to test out the then-new CSS :has() selector.
- This project never got much traction until now, so I never bothered to write about how it works. Simon Willison now already wrote a blog post about it, so I guess I don't have to anymore... https://simonwillison.net/2025/May/26/css-minecraft/
- For the best experience, please view this on a desktop browser, either Chromium-based or Firefox.
- The source code is at https://github.com/BenjaminAster/CSS-Minecraft. The "index.pug" and "main.scss" files contain the actual source code; the rest is mostly just the compiled output.
- Here is a video of me building a house with it: https://www.youtube.com/watch?v=OH8-Y9frP5k
I made some of my own notes on how this works here: https://simonwillison.net/2025/May/26/css-minecraft/
That's why it was done
For fun and to see whether it could be done
I kind of like it.
Wayback machine for when it used to work: https://web.archive.org/web/20250317122419/https://benjamina...
Even the least offenders, GitHub Pages, broke links before [0].
[0]: https://github.blog/news-insights/product-news/new-github-pa...
As I've hit my mid-life slide and (regressed|progressed) back to my youth-self, I've found myself just writing a bunch of apps and sites in html and css and really enjoying it.
One thing I still would like to see cracked is a random-like number in pure CSS. You can almost us there with some of the math functions and browser attributes, but I haven't found anything reliable.
To answer your question, LLMs confirm you can't generate a random number in CSS.
I really like doing this when something extraordinary happens by "accident".
https://github.com/BenjaminAster/CSS-Minecraft/blob/main/mai...
https://web.archive.org/web/20250317122419/https://benjamina...
Concatenating strings is not that complicated.
... and 46,022 lines of HTML (3.07MB)
It implements voxels via <input type="radio" />.
Each of the faces of each voxel is configured via <label>s, one for each face having a different CSS class.
There is a voxel for each type of block (dirt, grass, stone, etc) and only one is activated at a time.
The <input>s are arranged in a 9x9 grid 10 blocks tall times the number of different types of blocks (about 6500 total).
All that is enclosed with <div>s with CSS classes that respond to the camera navigation (look up/down, move up/down, forward/back, clockwise/counter)
That is brilliant!
https://html.spec.whatwg.org/dev/input.html#the-input-elemen...
This is insane to me.
In 2019 they released a web version of minecraft classic, as a quirky marketing thing for the game's anniversary. But what they released turned out to be built on my open-source voxel engine, and when I dug around their code I realized they'd yoinked my engine a solid two years earlier.
And the demo they released was probably not two year's of work, so my theory is that somebody at Mojang investigated the idea of minecraft-but-JS, and made a demo but then decided not to pursue it, and then later on it got recycled for the marketing demo. (which, annoyingly for me, they pretended was an old alpha build of Minecraft instead of a new thing built on open source.)
The demo is still live, though the multiplayer stopped working the same day it launched:
It's probably a total coincidence, but I like to imagine that the comment came from somebody at Mojang, and that my awful code is the reason why minecraft isn't a web app today :D
>On 7 May, 2019, coinciding with Minecraft's 10th anniversary, a JavaScript recreation of an old 2009 Java Edition build named Minecraft Classic was made available to play online for free.
This has always been the case with CSS, hasn't it? When you use it for rendering something relatively complex, you're kinda doomed.
I get the dream, we want everything to be declarative, and leave room for future optimizations, so that we can write once and run everywhere forever.
But in practice, it's not really an improvement over traditional GUIs that let you draw directly. Hence CSS is literally adding draw[1].
This is a huge reason 90s.dev doesn't use HTML/CSS but starts from scratch and lets you draw right into WebGL2 yourself, or with high-level APIs if you want.
[1] https://developer.mozilla.org/en-US/docs/Web/API/CSS_Paintin...
Can you describe a time that happened to you, and why you felt doomed?
That doesn’t like something that a person who has really used CSS in any meaningful way would say. Sharp edges, sure, but what technology doesn’t have that?