CSS 网格涂鸦
css-doodle,Yuan Chuan,2017 年

正在布展…
它是怎么做的
- 第 1 步Web Component 在 Shadow DOM 中生成 N×M 个格子。
- 第 2 步自定义语法在每个格子上展开,@i、@x、@y 提供索引。
- 第 3 步@rand、@pick 等函数在编译期为每格产出不同值。
- 第 4 步点击可重新随机,生成新的变体。
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
Create a custom element that reads its text content as a template, parses a grid size, and renders that many child divs in a shadow root using CSS grid. Before injecting styles, expand placeholder functions per cell: index, row, column, a seeded random range, and pick-one-of-list. Emit one :nth-child rule per cell (or inline custom properties) so each cell gets its own values. Re-seed and re-render on click for instant variations.
档案
性能开销
轻重
视觉强度
安静强烈
实现难度
一个下午数周打磨
尺度为策展判断(1 到 5),用于比较和推荐。
核实记录:Repo via gh api: MIT, created 2017-02-14, homepage css-doodle.com. The site itself returned a Cloudflare challenge (403) to curl/WebFetch, so the live demo is unverified beyond the repo.


