跪拜 Guibai
← All articles
Frontend · AI Programming · HTML

The 6-Cell Prompt That Makes AI Build a Whole Website You Can Double-Click Open

By ENCI ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most AI-generated web pages fail for beginners at the prompt stage, not the code stage; this gives Western developers a copyable prompt structure and a zero-dependency single-file pattern that sidesteps hosting, CDN, and local-file pitfall entirely.

Summary

AI fails at making a company website not because it can't write HTML, but because the person asking didn't specify three things: the page sections, the visual style, and the deliverable form. This guide turns that into a six-cell checklist — who sees it, what sections, what style, what sizes, how to deliver, how to accept — and feeds it to an AI as a copy-ready prompt.

Each cell forces verifiable specifications: style becomes numbers like "content area 1120px, section spacing 88px, one primary color"; delivery becomes "single index.html, all CSS and JS inline, zero external CDN or fonts"; acceptance becomes countable rules like "no horizontal scrollbar at 1440px or 390px." A full 13.6 KB runnable file demonstrates the result — 6 semantic blocks, zero external requests, zero console errors.

Local opening is handled too: show file extensions, save with UTF-8, handle the `.txt` trap, and a troubleshooting table covers symptoms like blank screens, garbled layout, and CORS errors from `file://` fetch calls. The solution is to avoid `fetch` entirely and write data as JS arrays.

Takeaways
— AI-generated web pages fail because the prompt lacks three specifications: section list, judgeable style, and deliverable form.
— A homepage needs only 6 sections: nav, hero, services, proof, contact, footer.
— Style words like "grand" or "premium" are useless; translate them to numbers like 1120px content width, 88px spacing, 1 accent color.
— The copy-ready prompt forces AI to output structure and copy first, then code only after confirmation, then self-check against acceptance criteria.
— Deliverable must be a single index.html with inline CSS/JS, no external CDN, fonts, or images; visuals drawn with CSS gradients or inline SVG.
— Breaking generation into three segments — skeleton, hero, mobile — prevents context loss over 600 lines.
— Responsive requires explicit breakpoints; without them AI skips mobile.
— Awwwards/Dribbble sites are visual references, not usability references; have AI learn layout rhythm but not interaction complexity.
— Local double-click runs under file://, where fetch() reads of local files throw CORS errors; write data as JS arrays instead.
— Windows hides file extensions, causing index.html.txt; show extensions and save with UTF-8.
— The sample single-file page uses 13.6 KB, 6 semantic sections, 0 external requests, 0 console errors, and no horizontal scrollbar at 1440px or 390px.
Conclusions

Treating AI as a contractor — giving it a floor plan, material list, and acceptance criteria — is more effective than treating it as a magic generator that reads minds.

The real bottleneck for AI-generated websites is not AI capability but the human's ability to make design requirements countable and testable.

Single-file output with zero external dependencies doubles as a distribution mechanism: a zip file can ship a full website to anyone without hosting.

The advice to avoid fetch() for local files shows how AI tools can silently produce code that breaks under file://; knowing the runtime context matters as much as the prompt.

Awwwards-winning aesthetics are often at odds with usability, which is why the guide explicitly separates visual rhythm from interaction complexity.

Concepts & terms
Six-cell prompt checklist
A structured way to specify an AI web-design request: who sees it, what sections, what style, what responsive sizes, how to deliver, how to accept. Each cell is written as countable specs rather than vague adjectives.
Single-file deliverable
An index.html that inlines all CSS, JS, and visual assets (CSS gradients or inline SVG) and references no external URLs. It opens with a double-click and can be distributed as a plain file or zip.
file:// CORS limitation
Browsers block fetch() requests to local files when a page is opened via the file:// protocol, producing a CORS error. The workaround is to embed data directly into JavaScript instead of fetching it.
Responsive breakpoint
A defined screen width (e.g., 900px) at which the layout switches from multi-column to single-column. AI needs explicit breakpoints in the prompt to build mobile layouts by default.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗