Build the card with AI
You will not write every line — you will direct a model to. The skill is knowing enough to catch what it gets wrong.
The same card — produced by a coding model under your direction, then corrected by your review.
What to understand about the box model BEFORE you prompt, how to write the prompt, and the exact things to check in the output.
Prerequisites
A coding assistant (Claude, Codex, Copilot — any). No CSS mastery required; that is the point.
The 20% you must own before you prompt
You cannot review what you do not understand. For a card, the mental model you need fits on a postcard:
- Every element is a box: content → padding → border → margin, from the inside out.
- box-sizing: border-box makes width include padding and border — the difference between layouts that hold and layouts that overflow.
- Padding is space inside the box; margin is space outside it. Faking one with the other is the single most common AI mistake.
Prompt design
Writing inputs that lead a model to do the work you actually want — the skill that replaces "Google it" in the AI era.
Want the full picture? Open the reference →
The prompt
A good prompt names the constraints a senior would name. Vague in, vague out:
Build a reusable "card" component in plain HTML and CSS — no framework, no build step. Constraints:- Set box-sizing: border-box globally so width includes padding and border.- Card: max-width 320px, 24px internal padding, 16px corner radius.- One soft elevation shadow. No border.- Dark surface (#11151c) with legible body text — check the contrast.- A primary button with its own padding and a hover state. Output one index.html and one styles.css. Add one short comment per rule explaining the spacing decision.Review what it writes
This is the senior move. Run the output against a checklist before you trust it:
Review rubric
Now take the model’s output and change one thing — bump the padding, soften the shadow — and watch it respond. Editing what the AI wrote is how you learn faster than it does:
Tutorial
Want the why first?
The Learn and Deep tabs teach the box model directly. Come back here when you want to build with it.
Concepts covered · 2
More like this
Make a page respond: a click counter
A page becomes alive the moment JavaScript listens for an event and changes the page in response. Build a counter, then open it in /code.
Build interaction with AI
The vibe-coder path for JS events: the event→state→render loop you must hold in your head, the prompt, and the review.
Build a script with AI
The vibe-coder path for Python: the shape of a small program, the prompt, and the edge cases AI forgets.
Liked this one?
Pass it on
Discussion
Be the first to ask
Your questions stay private with the team. We can pin answers to share with everyone.
Sign in to ask a question privately on this tutorial.
Sign inNo pinned answers yet for this tutorial.