繁中 →
visitors
Zero to Product EP.5

Build your first web page with AI

Why three layers, and the three levels of instruction for changing a page

← Back to the series
📅 Published 2026-04-08🔄 Last updated 2026-04-08

Let me start with something that may surprise you:

a vibe coder in 2026
doesn't write HTML, CSS, or JavaScript.
Not one line.

So what does this episode teach?

It teaches why the page the AI wrote
looks the way it does.

Once you know why it looks like that,
you know which part to ask the AI to change.
Once you know which part,
you can phrase it right and get it fixed in one pass,
instead of going 10 rounds with the AI and getting nowhere.

This episode is the turning point of the series.
From here on,
you'll be speaking the same language as the AI.

Part A: why the page the AI wrote looks like that

Your first prompt

Say you open Antigravity (or any AI tool),
and your first message is:

build me a personal profile page.
Name, a short bio, an avatar, and a contact button.

Three seconds later the AI hands you three files:

1
index.html
looks like text with some <div><p> angle brackets
2
style.css
looks like words such as color, font-size, padding
3
script.js
looks like functions and some English logic

You open the folder,
and the first question in your head is:

why does it have to be three files?
Can't it all go in one?

That question is what this episode answers.

The real reason for splitting into three layers

The real reason is practical.
It has nothing to do with what textbooks say,
and everything to do with the concrete benefit that splitting gives both the AI and you.

① Changing one thing doesn't break another

Picture this:
if everything lived in one file
and you told the AI to make the button blue,
the AI would have to scan a 1000-line blob
to find that button,
and it might break something nearby on the way.

With three layers:

Change the text
→ the AI only touches index.html, CSS and JS stay untouched
Change the color
→ the AI only touches style.css, the HTML structure stays put
Change the behavior
→ the AI only touches script.js, the look stays the same

This matters a lot for a vibe coder.
You'll notice the AI messing with unrelated parts much less
when it changes one thing.

② One style sheet can cover many pages

If you're building a site with many pages,
you'll have 5, 10, 20 separate HTML files.

If the styling is buried inside the HTML,
changing one color
means editing 20 files.

Once CSS is its own layer,
you change one style.css
and 20 pages change color at once.

That's also why, when we get to GitHub and deployment later,
the time the layers save you gets more and more ridiculous.

③ The AI reads it faster too

AI tools have this idea of context.
There's a limit to how much it can read at once.

If your page is crammed into one file,
the AI has to read the whole thing for any change.

With layers,
a color change means the AI only reads style.css,
which is faster, uses less quota, and goes wrong less often.

The three layers are a way of working designed for humans and AI together.
In 2026 that split matters more, not less.
A stronger AI doesn't make it obsolete, it makes it count for more.

What each layer does (one line each)

HTML
what is on the page
Headings, paragraphs, images, buttons, forms. Every thing you can see lives in this layer
CSS
what those things look like
Color, size, font, position, spacing, animation. Everything visual lives in this layer
JavaScript
what happens when you press something
Click responses, form submits, talking to a backend API, timers. Every action lives in this layer

You don't need to memorize syntax,
but you do need to remember this split.
Because in Part B we use exactly this split
to teach you how to phrase instructions.

Part B: the three levels of instruction for changing a page

You have a first version of the page now,
and it scores about 80.
You want it at 100.

A vibe coder spends 90% of the time changing things.
The time spent building from scratch is small.

When you change something,
your instruction has to match the layer.
Match the wrong one and the AI builds something you didn't want.

Level 1: you want to add something → HTML instructions

Verbs like add, put, insert, create.

Add a contact button in the footer

Insert a slogan under the main heading

Turn that image into a hero section (a big image, a heading, a subheading)

All of these mean one more thing on the page,
so what the AI touches is the HTML.

When you give this kind of instruction,
be clear about what the new thing sits next to.
For example:

Not precise enough
Add a button
Precise enough
Right under the main heading, add a button that says Contact me

Spell out position and content,
and the AI places it correctly the first time.

Level 2: you want to change the look → CSS instructions

Verbs like make it, change it to, a bit bigger, different color, rounded, right-aligned.

Make the button blue

Make all the text one size bigger

Center the main heading, bold it, add a shadow

Give every card rounded corners and a soft shadow

All of these mean the same thing is there but it looks different,
so what the AI touches is the CSS.

For this kind of instruction,
adjectives work better than numbers.
You won't remember whether the padding is 16px or 20px,
but you do know when something feels tight or needs more room.

Use adjectives
Make the button a bit bigger, the corners rounder, the color warmer
Use feel
The whole thing feels tight, give it more room to breathe
Use comparison
Get it closer to that clean Linear feel

The AI responds better to adjectives and comparisons
than to a precise instruction like padding: 24px.

Level 3: you want to add behavior → JS instructions

Verbs like click, press, hover, pop up, automatically, submit.

Click the button and a comment box pops up

Hover over a card and it scales up slightly

Show a sent message after the form is submitted

Pop up a subscribe box 3 seconds after the page loads

All of these are things that happen when you interact,
so what the AI touches is the JavaScript.

For this kind of instruction,
spell out three things: the trigger, the response, and the end state.

Trigger
When does it happen? (on click / on hover / 5 seconds after load)
Response
What does it do? (show a message / change color / submit / redirect)
End state
What happens after? (close itself / stay open / lock the button)

Say all three clearly
and the AI won't improvise.

One button, three ways to change it

Same button,
three ways to change it across three different layers.
Read this example once
and you'll always remember how to tell them apart.

Scenario: there's a Subscribe button in the top right of your page,
and you want it to be different.

Change ①: the text or the position → HTML layer

Instruction
Change Subscribe to Join the newsletter, and move it from the top right to the center of the footer
What the AI touches
index.html, the button's text and its position (moved from the header to the footer)

Change ②: the look → CSS layer

Instruction
Make the button dark green with white text, rounder corners, a soft shadow, and a darker color on hover
What the AI touches
style.css, the background, color, border-radius, box-shadow, and :hover styles

Change ③: the behavior → JS layer

Instruction
When the button is clicked, show a small window for an email address. After the user submits, the button becomes Thanks for subscribing and is disabled
What the AI touches
script.js, a click event, a modal, form handling, and the button state

One button, three changes, three files.
Once you see this split,
the next time you ask the AI to change something
you'll know automatically which layer your instruction lands in.

The instruction traps vibe coders fall into

Trap 1: mixing all three layers into one instruction

Bad instruction
Make the button green, move it down, and pop a message when it's clicked

Three things in one sentence.
The AI usually finishes the first two,
half-finishes the third,
and you can't tell what went wrong where.

Good instruction
Three rounds: change the color first, run it, then the position, run it, then add the click event

Trap 2: working back from the effect to the syntax

Bad instruction
I want padding 20, margin 16, border-radius 8

A vibe coder won't pick better numbers than the AI,
so describe the feel instead.

Good instruction
Loosen the whole thing up a bit and make the corners rounder

Trap 3: not being clear about which file the change is in

Bad instruction
Swap out the button

The AI can't tell whether you mean the HTML layer, moving the button,
or the CSS layer, a different style.

Good instruction
Change how the button looks, keep the text and the position (→ locked to the CSS layer)

A template for your instructions

Next time you want the AI to change a page,
use this structure:

[Layer]: I want to [change / add / swap]
Position: [next to which element / inside which block]
Content: [what it should become / what goes in]
Interaction: [on click / on hover / automatic]
The result I want: [one line describing the feel]

Save this template.
Week one it feels mechanical,
week two you notice the AI getting it wrong far less,
week three the structure becomes instinct whenever you talk to the AI.

Giving the right instruction beats writing code

You don't need to memorize syntax.
You need to remember the three layers and the instruction pattern that goes with each.
Everything else is the AI's job.

Once you've worked through the three levels of instruction,
you'll probably notice something:

some things
you simply can't describe in words.

The card I want is nothing like the one you made,
but I don't know how to tell you what I want...

When that feeling shows up,
more precise wording won't save you.
What you need is to draw it for the AI.

In EP.6,
we move into Figma,
where a vibe coder spends the least possible learning time
turning the picture in their head into a design the AI can read.

Previous
EP.4 Before you start: the tools you need
Next, coming soon
EP.6 Think the screen through in Figma

Follow the series

New episodes get announced on Threads

Follow @kanisleo328