HTML

Search documents
零JS,他用4.6万行HTML+CSS手搓了个《我的世界》,程序员哭诉:网友把服务器玩爆了
3 6 Ke· 2025-05-28 12:14
Core Concept - A developer named Benjamin Aster created a clone of Minecraft using only HTML and CSS, without any JavaScript, showcasing the potential of these technologies in building interactive web applications [1][3][17]. Project Overview - The project consists of 480 lines of CSS and 46,022 lines of HTML, resulting in a 3D world where users can add and remove blocks and rotate the view [3][4][17]. - The game allows interaction within a 9x9x9 grid, featuring 7 different types of blocks [3][6]. Technical Implementation - The project utilizes 35,001 `<label>` tags and 5,840 `<input type="radio">` buttons to manage the state of the blocks, with each block having six sides represented by labels [6][7]. - The `:has()` selector in CSS is a key technique that enables the interaction logic, allowing for dynamic visibility of block types based on user selection [6][13]. - To generate the extensive HTML structure, Aster employed Pug, a templating language, which simplifies the creation of nested elements [6][7]. Animation and Interaction - CSS animations are used to control the 3D view and rotation, with specific rules defined for button interactions that trigger animations [9][12]. - The design allows for a seamless user experience, where pressing and holding buttons initiates animations that manipulate 3D transformation properties [12]. Community Response - The project gained significant attention on Hacker News, with users expressing admiration for the innovative use of CSS and the creativity behind the implementation [13][14]. - Aster noted that the project was originally an experimental work from three years ago, aimed at exploring the limits of pure CSS [14][17]. Access and Experience - Users can experience the project through a dedicated website, which has seen increased traffic, leading Aster to switch hosting services to accommodate the demand [14][15]. - For optimal performance, it is recommended to access the project using desktop browsers, particularly those based on Chromium or Firefox [15].
不同程序员的老婆生了娃,他们的代码长啥样?笑死!
菜鸟教程· 2025-05-05 10:49
Core Viewpoint - The article humorously illustrates how different programming languages would approach the creation of a newborn baby, showcasing the unique characteristics and quirks of each language's syntax and style [1][3][6]. Group 1: Python - The Python version emphasizes precision, capturing the birth time down to the millisecond, reflecting the meticulous nature of a programmer [1]. - It includes a welcoming function for the newborn, demonstrating object-oriented programming principles [3]. Group 2: Java - The Java implementation is characterized by a heavy use of getter methods, highlighting the verbosity often associated with Java code [5]. - It also includes a welcoming message, similar to the Python version, showcasing the commonality of this feature across languages [3]. Group 3: JavaScript - The JavaScript version introduces randomness in determining the baby's gender, adding a playful element to the code [6]. - It also includes a whimsical welcome function, reflecting the dynamic nature of JavaScript [6]. Group 4: C++ - The C++ version focuses on memory management, with the newborn being allocated on the stack to prevent memory leaks, showcasing the language's emphasis on performance [8]. Group 5: Go - The Go implementation is noted for its strict struct alignment, reflecting the language's focus on simplicity and clarity [10]. Group 6: PHP - The PHP version uses an array to represent the newborn, indicating a more flexible and less structured approach compared to other languages [10]. - It features an anonymous function for the welcome message, which is a common practice in PHP [10]. Group 7: Bash - The Bash script version humorously suggests that the newborn will likely become an operations and maintenance professional, reflecting the practical use of shell scripting [11]. Group 8: HTML - The HTML representation of the newborn suggests a static structure, with a recommendation to add animations, indicating a focus on front-end design [15]. Group 9: C - The C version uses the var keyword, indicating a more modern and flexible approach to variable declaration, typical of C developers [15].