BLOG
How to Edit AI-Generated CSS Without Asking AI to Rewrite Everything
The shadow is too strong, so you ask for a subtler one - and get forty new lines in which the padding also changed and the transition you liked is gone. That loop is the problem, and there is a shorter one.
Why the re-prompt loop never converges
Ask for a small change and you receive a whole document. That is how text generation works: the model does not edit your file, it produces a new one. Three consequences follow.
- You cannot see what changed. Diffing two blocks of CSS by eye is slow and unreliable, especially when the model also reformats.
- The things you liked can silently change. Values you never mentioned get "improved" - spacing, hover states, letter-spacing, transitions.
- The block grows. Each round tends to add rather than subtract. What started as three properties becomes fifteen, and most of them are nobody's decision.
Worst of all, you are describing a visual difference in words. "Make the corners slightly smaller" is a request about an image, delivered to something that cannot see your page. It will guess, and you will have to check anyway.
AI generates the first draft. Finishing it is judgement, and judgement needs something to look at. Generation and finishing are different jobs.
Translate the block into the controls you actually wanted
Here is a typical first draft for a product card:
.product-card {
padding: 32px;
border-radius: 24px;
box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
background: #ffffff;
}
Read as code, this is a wall of numbers. Read as intent, it is four decisions - and each decision is something you can see and adjust directly:
- Padding - how much air is inside the card
- Radius - how round the corners are
- Shadow - how far the card lifts off the page
- Background - the card's colour, including its opacity
Once you see it that way, "the shadow is too strong" stops being a prompt and becomes one number:
rgba(0, 0, 0, .15) becomes .08, or the 40px blur becomes 12px. You
make the change by looking at the card, not by describing it.
Here is the translation, property by property. This is the whole job of finishing a generated block - everything on the left is something an assistant can write, and everything on the right is something you can decide by looking:
| PROPERTY IN THE DRAFT | WHAT IT ACTUALLY DECIDES | HOW YOU FINISH IT |
|---|---|---|
padding |
How much air is inside the box | Look at the text against the edge; raise it until it stops feeling tight |
border-radius |
How round the corners are | 0-4 crisp, 6-12 soft, 16-24 friendly, 999 pill - pick by eye and keep it consistent |
box-shadow |
How far the element lifts off the page | Lower the opacity first, then the blur; on dark backgrounds use a border instead |
background |
The fill colour, including how opaque it is | Check it against the real section behind it, not against white |
font-size / line-height |
Whether text reads as a document or a poster | Headings 1.4-1.8x body size; body leading around 1.6 |
max-width |
How many characters sit on one line | Around 60-75 characters - roughly 68ch |
gap |
The space between siblings in a grid or flex row | Set it once on the parent instead of margins on each child |
transition |
Whether changes feel instant or animated | Usually safe to delete - it is decoration you did not ask for |
Two entries there are worth dwelling on. Delete what you did not ask for - the transition, the hover state, the letter-spacing - because every property you carry over is a property you now own. And check colours and shadows against your real background, which is the one thing a generated draft can never get right, since the model has not seen your page.
Ceramic pour-over
Hand-thrown, 400ml, dishwasher safe.
Add to cartCeramic pour-over
Hand-thrown, 400ml, dishwasher safe.
Add to cartSame draft, two values changed by looking. No second prompt required.
The loop to use instead
Generate once → Visualize → Adjust → Copy → Verify.
- Generate once. Take the first reasonable draft and stop asking. A mediocre draft plus two visual adjustments beats six rounds of prompting, and it is faster.
- Visualize it on your own markup. Paste the section - not just the CSS - into the CSS Code Editor and see it rendered. This is the step the re-prompt loop skips, and it is the one that decides everything.
- Adjust one value at a time. Change the shadow, look. Change the radius, look. Doing them one at a time is what tells you which change produced which effect - the thing the re-prompt loop makes impossible.
- Copy only what you changed. Not the whole block. If the draft's padding was already fine, do not carry it over. Fewer properties means fewer future surprises, and it keeps the snippet yours rather than the model's.
- Verify scope. Read the selector and check where it applies on your live site. The model guessed it; see Why Copy-Pasting CSS Into Squarespace Sometimes Breaks Your Site.
Steps three and four are where the time is saved. A one-property snippet is also a snippet you understand, which is the difference between having custom CSS and being owned by it.
Ask for output that is easy to finish
Prompting still matters - not to get it right, but to get something workable. Four requests that consistently help:
- "Comment each property with what it does." An annotated block is a block you can sanity-check line by line, and delete from confidently.
- "Give me the smallest rule that does only this." Models default to generous output - padding, transitions and hover states you never asked for. Asking for the minimum gives you two properties instead of fifteen.
- "No !important, and tell me if a rule will not apply without it." If the answer is that it will not, that is diagnostic: the theme's rule is winning, and the fix is a more specific selector, not an override.
- "Here is my actual class name." Right-click, Inspect, copy the class, paste it in. Selector errors are the largest single cause of "the CSS did nothing", and this removes the guess entirely.
When you genuinely should ask again
Finishing visually is not a rule against using the tool. Go back to the assistant when:
- The rule does nothing at all. That is a selector or cascade problem, not a value problem, and no amount of looking will fix it.
- You need something structural. A media query, a grid that reflows, a sticky element - these are constructions, not values. Ask for them.
- You do not know which property is responsible. Describe the symptom and ask "which property causes this?" That question uses the model for what it is good at: naming the mechanism.
The distinction is: ask for mechanisms, adjust values yourself. Mechanisms are knowledge; values are taste, and taste needs eyes.
Keep your custom CSS survivable
Editing generated code yourself has one more payoff: the CSS stays readable. Three habits that cost almost nothing:
- Comment with date and purpose. "Rounded buttons, Nov 2026." Six months later, that line is the difference between a two-minute edit and an afternoon.
- Delete what you did not keep. Dead rules are the reason nobody dares touch their Custom CSS panel.
- Group by page or component. Generated snippets arrive in the order the model thought of them, which is never the order you will need them in.
Real scenarios
The maker and the pill buttons. She asked for rounded buttons and got
border-radius: 999px, which is what "rounded" literally means and not what she
pictured. Seeing it rendered, she dropped to 6px in one adjustment instead of describing
"not that round" in another paragraph.
The consultant with the dark theme. The generated shadow was tuned for a light background and read as a smear on his near-black section. One look, one value - a task that three re-prompts had failed at, because the model did not know the background was dark.
The shop owner who stopped re-prompting. Her fourth request for "slightly smaller" returned yet another full block with different padding. She took the first draft, rendered it, and changed two numbers. Her Custom CSS went from forty lines she did not understand to four lines she did.
Questions people ask
Is editing generated CSS safe if I do not know CSS?
Changing a value is much safer than writing a rule, and seeing the result is what makes it safe. What you still need is the five-second selector habit - knowing which elements the rule reaches - because no preview can tell you that about your live site.
Why does the AI keep changing things I did not ask about?
Because it regenerates the whole block rather than editing one line. Asking for the smallest possible rule reduces this, and deleting what you did not need finishes it.
What if the generated CSS does not apply at all?
That is scope or specificity, not a value problem. Paste your real class name into the prompt, or narrow the selector yourself; read Why Copy-Pasting CSS Sometimes Breaks Your Site for the diagnosis order.
Does this mean I should stop using AI for CSS?
No - it is very good at the first draft and at naming mechanisms. It is bad at the last mile, because the last mile is visual and it cannot see your page.
The short version
AI generates the first draft. You finish it visually. Take one draft, render it on your own markup, change the value that is wrong by looking at it, and copy only what you changed.
Why this matters more in 2026 than it did two years ago is covered in AI Can Write CSS for You. Here's Why You Still Need to See What It Does; for the values worth checking while you finish, see What Those CSS Numbers Actually Do.