Incredible. I was so skeptical that I went in on the neckruff and from there to a lacetop, it's really all generated based on background-image but without using images but gradients of specific colors, as well as box-shadows and the like.
I don't think any on the first page are interactive. There might be a few on the next page of it (I only found one where a pen changes color on hover).
- 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.
If anyone's wondering how it manages the state, a quick peek into the source code shows that it uses radiobuttons and the HTML contains all the blocks you could ever possibly place.
If anyone is equally curious how the camera state works, it looks like the camera is controlled by running animations when a button is in its :active state and pausing them otherwise.
I... you're right. I was wondering why the world was only 9x9x9, there's 46k lines showing each block can have air, stone, grass, dirt, log, wood, leaves, or glass.
Radio buttons and checkboxes really are magic when it comes to doing neat things in pure CSS. We used to have a lot of neat stuff like pure html/css tabs and toggles but they didn't pass an accessibility audit.
Makes you wonder, how many webpages are dependant on such services. The Web has always been brittle, but it's a little sad seeing a website not able to survive ~50k users on its first day online.
Even the least offenders, GitHub Pages, broke links before [0].
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.
Interesting! I'm not familiar with this approach and look forward to trying it. Do you think it can be used to set a var that can be used for generative colors?
Can they? I think it's weird that you ask a question (or, offer a possible solution in the shape of a question) without verifying your own assertion first.
To answer your question, LLMs confirm you can't generate a random number in CSS.
Truly incredible from an HTML perspective, but I think also a testament to how catchy and simple Minecraft is as a concept... a few minutes of noodling around in here and I already built myself a cute little tree and a hill: https://i.imgur.com/PjlDWo5.png
Just think about setting what Minecraft has achieved as requirements from the get go: 1) Be one of the most successful games ever created. 2) Basic game mechanics should be possible to be implemented via just HTML and CSS (no JS).
I really like doing this when something extraordinary happens by "accident".
It's absolutely brilliant how rotation and movement control is achieved by changing the animation-play-state value using the :active pseudo-class on button elements.
Recently I came across Quake implemented within a single WebGL shader (https://www.shadertoy.com/view/lsKfWd), but this is another level. HTML/CSS is a programming language now.
I think at some point the number of tabs doesn't matter because the tab is unloaded and the state is maybe stored on disk. As long as you don't open them, having them open shouldn't slow the browser down.
I remember discovering this trick nearly two decades ago. A co-worker and myself were a bit puzzled at the time and we kind of tossed the idea in the air that "doesn't this mean CSS is Turing Complete?" but we moved on to making things work on IE6 for old clients.
Very nice work :) especially that you even support building sideways and the "hover" always is perfectly placed. Thats something that amazes me the most how clean it feels to place a block. Very good job!
Pretty slick! I never had played minecraft before. I never knew how blocks were place down until I ran this page. But it needs to be able to use the mouse to rotate, and mouse-wheel to scale!
When playing the actual game, your viewpoint moves with the character, moved by the WASD keys and oriented with the mouse. You can only ever place one block at a time, though.
Only guessing, but I have a theory that Mojang considered that circa 2017 :D
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:
Humorous postscript, btw: two months after Mojang forked my voxel engine, somebody left an anonymous "this is awful, you are a terrible programmer" comment on the engine repo.
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
The full game was available on minecraft.net for many years. At times it was the only way to play multiplayer when the authentication server would go down.
Minor nit - "the full java version of an at-least 8 years old release" (which is necessarily missing -a lot- of what people would consider "Minecraft" these days.)
I don't get it - isn't this blatant copyright infringement? Seems like they're just running some kind of cracked Minecraft build with a JVM-in-JS layer or some such trickery?
Fun fact: one of the first versions of Minecraft (the "classic" one) was playable in a web browser. I actually did play it as a young teen and later thought I must have dreamt it, when I couldn't find it anywhere.
About a year ago I tried to make GPT give me a CAPTCHA using the same method and it failed (even after helping it quite a lot). I don't know how it would fare now. You can find a CAPTCHA like this in use for the Tor variant of Reddit (?).
> For the best performance, please close other tabs and running programs.
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.
> When you use it for rendering something relatively complex, you're kinda doomed.
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?
The game https://corru.observer/ is a great example of a CSS-rendered 3D video game that runs fairly well on modern devices (even playable on mobile although it'll try to block you based on viewport size if you're not in "desktop mode")
Without a doubt the most impressive thing I've seen with CSS.
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!
[0]: https://a.singlediv.com/
have you seen this modern marvel? https://diana-adrianne.com/purecss-lace/
Incredible. I was so skeptical that I went in on the neckruff and from there to a lacetop, it's really all generated based on background-image but without using images but gradients of specific colors, as well as box-shadows and the like.
Wow, Dark Reader absolutely mutilated her.
Wow, mobile Safari hates this. Zooming in and scrolling around crashes the page constantly.
6 replies →
this is my favorite one one I've seen: https://lyra.horse/css-clicker/
These were 1852 seconds well spent. If you don't hate clickers, try this one, it was definitely made with love.
latest in my long list of poor life choices, not going to bed at 2 AM because I'm waiting to reach 10 mil views :)))))
1 reply →
that endgame is absolutely perfect
Wierd, posting the last blog post crashed firefox.
Wild, got me hooked!
I had the honor of seeing her give a talk. She also has a lot of other css projects that are awesome.
https://lynnandtonic.com/work/
Also love seeing Phoenix devs mentioned!
Damn, that website is great on its own and it turns out she redesigns/rewrites it every year to learn new web technologies.
https://lynnandtonic.com/archive/
Got this bookmarked to click around for inspiration in my free time.
So many of these look deliciously interactive but aren’t. Is that because I’m on mobile or do they not do anything?
I don't think any on the first page are interactive. There might be a few on the next page of it (I only found one where a pen changes color on hover).
poring over it or pouring your attention :)
My bad, I forgot I'm a liquid. It's too late to edit, but s/po\w*/poured over/ anyway :)
but they are all individual divs
Hello people, author here!
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
This was criminally underrated, great job
This is fiendishly clever, and really quite elegant.
I made some of my own notes on how this works here: https://simonwillison.net/2025/May/26/css-minecraft/
This is how CSS CAPTCHAs are made (for Tor websites), and sign up / login modals, and many other stuff.
good write up, thanks. talk about a combinatorial explosion!
[dead]
But highly impractical and far beyond what CSS should be used for.
Obviously...
That's why it was done
For fun and to see whether it could be done
7 replies →
If you really wanna get your blood boiling how about some Doom with HTML checkboxes - https://healeycodes.com/doom-rendered-via-checkboxes
If anyone's wondering how it manages the state, a quick peek into the source code shows that it uses radiobuttons and the HTML contains all the blocks you could ever possibly place.
If anyone is equally curious how the camera state works, it looks like the camera is controlled by running animations when a button is in its :active state and pausing them otherwise.
I... you're right. I was wondering why the world was only 9x9x9, there's 46k lines showing each block can have air, stone, grass, dirt, log, wood, leaves, or glass.
I kind of like it.
Radio buttons and checkboxes really are magic when it comes to doing neat things in pure CSS. We used to have a lot of neat stuff like pure html/css tabs and toggles but they didn't pass an accessibility audit.
That is the most hacky solution I may have ever seen in a CSS demo. I love it.
It's always radio buttons, every single time
Incredibly brilliant. Seems to have gone completely unnoticed 2.5 years ago.
https://news.ycombinator.com/item?id=33579407
See now that's amazing. Luck is such a factor in ... everything!
Another hug of death. The website says "It must be upgraded via the Firebase console before it can begin serving traffic again."
Wayback machine for when it used to work: https://web.archive.org/web/20250317122419/https://benjamina...
Makes you wonder, how many webpages are dependant on such services. The Web has always been brittle, but it's a little sad seeing a website not able to survive ~50k users on its first day online.
Even the least offenders, GitHub Pages, broke links before [0].
[0]: https://github.blog/news-insights/product-news/new-github-pa...
Best anti-firebase post I've ever seen
Yah, I hope this doesn't end up costing them an arm and a leg :( it was working last night
this project doesn't use a backend, so not sure why firebase is needed. github pages would have unlimited bandwidth.
Alternative URL for if the site has trouble keeping up: https://benjaminaster.github.io/CSS-Minecraft/
Very impressive!
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.
Is this a thing? https://medium.com/hypersphere-codes/randomness-in-css-b55a0...
Unfortunately that solution does not work on Firefox or Safari.
you can pretty easily get randomness for clickable stuff by animating the z-index of multiple objects
Interesting! I'm not familiar with this approach and look forward to trying it. Do you think it can be used to set a var that can be used for generative colors?
Can LLMs help?
Can they? I think it's weird that you ask a question (or, offer a possible solution in the shape of a question) without verifying your own assertion first.
To answer your question, LLMs confirm you can't generate a random number in CSS.
1 reply →
Truly incredible from an HTML perspective, but I think also a testament to how catchy and simple Minecraft is as a concept... a few minutes of noodling around in here and I already built myself a cute little tree and a hill: https://i.imgur.com/PjlDWo5.png
Just think about setting what Minecraft has achieved as requirements from the get go: 1) Be one of the most successful games ever created. 2) Basic game mechanics should be possible to be implemented via just HTML and CSS (no JS).
I really like doing this when something extraordinary happens by "accident".
Reminds me of a couple of Keith Clark's projects from a good 10+ years back
https://keithclark.co.uk/labs/css-fps/desktop/
https://keithclark.co.uk/labs/css-3d-shadows/
It's absolutely brilliant how rotation and movement control is achieved by changing the animation-play-state value using the :active pseudo-class on button elements.
https://github.com/BenjaminAster/CSS-Minecraft/blob/main/mai...
I got "Bandwidth Quota Exceeded"
It also works on the web archive.
https://web.archive.org/web/20250317122419/https://benjamina...
Same, maybe shouldn't go with the serverless hype.. It's a static website after all :D
Get the archive from github and load it locally: https://github.com/BenjaminAster/CSS-Minecraft/archive/refs/...
Pug is an unsung hero in this demo. The template engine made it possible to brute force the UI with 4 levels of nested loop. Impressive!
Is pug doing something special here that another template engine, or just a custom script, could not do?
Concatenating strings is not that complicated.
You could write a script in JS to generate all the elements, then save the rendered HTML. Bootstrapping a HTML+CSS only site with HTML+CSS+JS.
And it's only 480 lines of CSS! https://github.com/BenjaminAster/CSS-Minecraft/blob/main/mai...
... and 46,022 lines of HTML (3.07MB)
Recently I came across Quake implemented within a single WebGL shader (https://www.shadertoy.com/view/lsKfWd), but this is another level. HTML/CSS is a programming language now.
It’s extremely impressive, but it’s not “Quake”; it’s only the difficulty selection hallway from Quake. No enemies.
Please tell me if I understood it correctly:
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!
Note: the <input> tag does not use and does not need a closing slash and never has in any HTML specification.
https://html.spec.whatwg.org/dev/input.html#the-input-elemen...
It's sometimes done to make the same markup compatible with XHTML, without harming its interpretation in HTML.
10 replies →
Blew my mind. I have hundreds of tabs open, no issue on linux chrome.
I think at some point the number of tabs doesn't matter because the tab is unloaded and the state is maybe stored on disk. As long as you don't open them, having them open shouldn't slow the browser down.
Another impressive CSS creation -- CSS Puzzle Box: https://suricrasia.online/puzzlebox/
Damn, just visiting this site makes me want to reinstall Minecraft haha.
Did anyone else involuntarily let out multiple expletives when they saw it and it dawned on them how hard this must have been?
This is insane to me.
I remember discovering this trick nearly two decades ago. A co-worker and myself were a bit puzzled at the time and we kind of tossed the idea in the air that "doesn't this mean CSS is Turing Complete?" but we moved on to making things work on IE6 for old clients.
https://web.archive.org/web/20250317122419/https://benjamina...
I also got "Bandwidth Quota Exceeded". Seems like you're doing well!
Very nice work :) especially that you even support building sideways and the "hover" always is perfectly placed. Thats something that amazes me the most how clean it feels to place a block. Very good job!
Pretty slick! I never had played minecraft before. I never knew how blocks were place down until I ran this page. But it needs to be able to use the mouse to rotate, and mouse-wheel to scale!
When playing the actual game, your viewpoint moves with the character, moved by the WASD keys and oriented with the mouse. You can only ever place one block at a time, though.
My one regret in life is not having seen this before your Firebase credits were spent for the month. Looking forward to a June attempt!
View it on GitHub Pages instead ;) https://benjaminaster.github.io/CSS-Minecraft/
Web-based minecraft, when?
Only guessing, but I have a theory that Mojang considered that circa 2017 :D
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:
https://classic.minecraft.net/
Humorous postscript, btw: two months after Mojang forked my voxel engine, somebody left an anonymous "this is awful, you are a terrible programmer" comment on the engine repo.
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
2 replies →
You used to be able to play Minecraft classic directly on minecraft.net
It still exists at https://classic.minecraft.net/
3 replies →
The full game was available on minecraft.net for many years. At times it was the only way to play multiplayer when the authentication server would go down.
The full java version of the game was ported to webassembly/webgl a while ago. It's called eaglercraft: https://eaglercraft.com
Minor nit - "the full java version of an at-least 8 years old release" (which is necessarily missing -a lot- of what people would consider "Minecraft" these days.)
1 reply →
I don't get it - isn't this blatant copyright infringement? Seems like they're just running some kind of cracked Minecraft build with a JVM-in-JS layer or some such trickery?
1 reply →
Fun fact: one of the first versions of Minecraft (the "classic" one) was playable in a web browser. I actually did play it as a young teen and later thought I must have dreamt it, when I couldn't find it anywhere.
Yeah I remember that. I think it was back in version 1.6 or something. It kinda blew my mind as a kid playing a full-on computer game in a browser.
It got extended, embraced and extinguished.
3 replies →
The phone is ringing—Java Applets called B-)
This is breathtaking and embodiment of creativity. Truly a legend!
Doing this art just with css ,you are greatest one in css sir.
Damn, this is impressive.
Very impressive
Chuối
Mind blowing
Brilliant !
Gj
that's amazing!!!
That's crazy
Well done!
[dead]
[flagged]
[flagged]
I wonder when AIs can write clever codes like this. Given a surprising constraint.
About a year ago I tried to make GPT give me a CAPTCHA using the same method and it failed (even after helping it quite a lot). I don't know how it would fare now. You can find a CAPTCHA like this in use for the Tor variant of Reddit (?).
> For the best performance, please close other tabs and running programs.
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...
> When you use it for rendering something relatively complex, you're kinda doomed.
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?
The game https://corru.observer/ is a great example of a CSS-rendered 3D video game that runs fairly well on modern devices (even playable on mobile although it'll try to block you based on viewport size if you're not in "desktop mode")
[flagged]
Stupid comment, sure. That's always true with me.
Shill for my app? I don't even know what shill means.
Plug for my app? Not really. It's pretty much dead atp. I'm just discussing my own experiences with the topic in the thread.
But yes, please downvote me. It helps remind me that this place isn't for me.
1 reply →