Spacing & Sizing for AI Coders
The #1 difference between amateur and professional websites. Master whitespace and your sites will instantly look better.
In this chapter
- Why spacing is the #1 difference between amateur and pro sites
- What padding, margin, and gap really mean
- How to give AI exact spacing instructions
- A simple spacing system you can reuse anywhere
The Golden Rule
When in doubt, add more space.
Beginners always cram things together. Professional designs breathe. White space is not wasted space: it guides the eye and creates hierarchy.
The 4px / 8px Grid System
All spacing should be multiples of 4px (or 8px for simplicity). This creates consistent, harmonious layouts.
Padding vs Margin vs Gap
← padding →
↕ margin
← gap →
Spacing Patterns to Know
These are the most common spacing patterns in professional websites. Tell your AI tool what you want and it will handle the details.
Max Widths & Container Sizes
Common Element Sizes
How to Describe Spacing to AI
âAdd more breathing room between sections. They feel too close together. Make the vertical spacing generous.â
âThe cards need more internal padding so the content isn't jammed against the edges. Also increase the space between the cards.â
âThe content stretches too wide on big screens. Center it and limit the max width so it looks good on all screen sizes.â
âThe text lines are too long to read comfortably. Limit the paragraph width so each line is about 65 characters.â
Prompt This
Copy-paste these prompts into your AI tool to apply what you just learned.
âReview my page layout and apply consistent spacing. Use 8px increments: 16px for tight gaps, 24px for related items, 48px between sections. Make sure padding and margins follow the same scale throughout.â
âMy page looks cramped. Add breathing room between sections and components using a consistent spacing scale. Increase padding inside cards, add more space between the heading and content, and make sure nothing feels jammed together.â
âSet up a centered page container with a max-width of [1280px / 1024px / 768px]. Add responsive horizontal padding: 16px on mobile, 24px on tablet, 48px on desktop. Center the container on the page.â
Frequently Asked Questions
How much space should I put between elements?
Use a consistent spacing scale. Most design systems use multiples of 4px or 8px. For example: 8px between related items, 16px between groups, 32-48px between sections. Ask your AI tool to set up a spacing system so everything stays consistent.
Why does my page feel cramped even though the content is good?
You probably need more whitespace. Beginners tend to pack elements too tightly. Add more padding inside cards, more margin between sections, and more line height in paragraphs. Whitespace makes your content easier to read.
What's the difference between margin and padding?
Padding is the space inside an element (between its border and its content). Margin is the space outside an element (between it and neighboring elements). Think of padding as the cushion inside a box, and margin as the gap between boxes.