In a remarkable demonstration of creativity and technical prowess, Benjamin Aster has successfully crafted a 3D Minecraft clone using solely CSS and HTML, steering clear of JavaScript entirely. While the project is confined to a modest 9x9x9 block world, the accomplishment stands as a testament to innovative thinking in web development.
Project Overview
The endeavor comprises approximately 40,000 lines of HTML, primarily utilizing radio buttons and labels, alongside fewer than 500 lines of CSS, which handle the intricate display mechanics. In a concise thread on X, Aster elaborates on the methodology behind this unique implementation. Each block within the limited space is represented by a combination of and
elements, which effectively track the types and orientations of the blocks. The CSS acts as a filter, determining which labels are visible based on user interactions.
Interaction is straightforward: clicking on a block corresponds to selecting a label, and altering the block type—whether it be “air” or another designation—changes the visible labels for the user. This clever manipulation of HTML elements allows for a surprisingly engaging experience within the constraints of traditional web technologies.
3D Visualization Techniques
The 3D aspect of the project is brought to life through CSS animations that apply various transforms to the displayed elements. Users can initiate and halt these animations via controls, resulting in a dynamic viewing experience that showcases the potential of CSS beyond its conventional applications. This project exemplifies how imaginative approaches can yield impressive results, even when working within the limitations of basic web languages.
For those interested in a deeper dive, Simon Willison offers a comprehensive analysis of the CSS-Minecraft project, and the complete code is available on GitHub for further exploration. After delving into this innovative creation, enthusiasts may also want to explore other intriguing adaptations, such as Minecraft in COBOL or even Minecraft running within Minecraft itself.