Web Design Principles, Shown Not Told
Good web design mostly comes from six habits: rank content with clear visual hierarchy, leave enough whitespace, keep text contrast at 4.5:1 or better, align things to shared edges, group related items close together, and make tap targets at least 24 pixels square. Flip each demo below between before and after to see the difference.
| Principle | Typical fix in CSS |
|---|---|
| Visual hierarchy | font-size, font-weight and color steps |
| Whitespace | padding and gap from one spacing scale |
| Contrast | darker text color, checked against the background |
| Alignment | one text-align and a shared container edge |
| Proximity | smaller gap inside groups, larger gap between them |
| Tap target size | min-height and min-width with padding |
Updated
Articles on design principles describe them in words and stock photos. Here each principle is a small product card or form drawn twice, broken and fixed, so you can toggle between the two and see exactly what changed.
Before and after demos
Visual hierarchy
Before: Title, price and button share one size and weight, so the eye has nowhere to land.
After: Size, weight and colour rank the content: title first, price second, action third.
Whitespace
Before: Everything is packed edge to edge, which reads as cluttered and hard to scan.
After: Generous padding and gaps separate groups and give each item room to breathe.
Contrast
Before: Light grey text on white falls well under the WCAG minimum for normal text.
After: Dark text on white clears 4.5:1, the WCAG 2.2 level AA minimum for normal-size text.
Alignment
Before: Mixed centred and left-aligned lines create ragged edges the eye has to chase.
After: One shared left edge turns separate lines into a single readable block.
Proximity
Before: Labels sit equally far from every field, so it is unclear which label belongs where.
After: Each label hugs its own field and pairs are spaced apart, so grouping is obvious.
Tap target size
Before: Tiny links crowd together and are easy to miss with a finger.
After: Targets are at least 24 by 24 CSS pixels, the WCAG 2.2 level AA minimum, with space between.
The fixes in CSS
Hierarchy, spacing and contrast on one card
Three type steps rank the content, spacing comes from an 8px scale, and the muted text stays dark enough to pass 4.5:1 on white.
<style>
.card { max-width: 280px; padding: 24px; border: 1px solid #e5e7eb; border-radius: 12px; font-family: system-ui, sans-serif; }
.card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 700; color: #111827; }
.card .price { margin: 0 0 16px; font-size: 16px; color: #4b5563; }
.card a { display: inline-block; min-height: 44px; padding: 12px 20px; box-sizing: border-box;
border-radius: 8px; background: #1d4ed8; color: #fff; font-weight: 600; text-decoration: none; }
</style>
<div class="card">
<h3>Sourdough loaf</h3>
<p class="price">$9, baked daily</p>
<a href="#order">Order now</a>
</div>
Principles work together
Fixing one principle often fixes another. Adding whitespace between groups improves proximity, and a single alignment edge makes the hierarchy easier to read because sizes are compared along the same line.
When a layout feels wrong but you cannot say why, run through the six in order. The first one that fails is usually the cause.
Consistency is the multiplier
A page can follow every principle and still feel messy if each section invents its own sizes. Define a short type scale, a spacing scale and a colour set, then reuse them everywhere.
That shared set is what designers call tokens. Once they exist, applying these principles becomes picking the right step instead of guessing a new number.
How it works
- Pick a principle from the list.
- Use the Before and After buttons to flip the demo.
- Read the two lines under the demo: what was wrong and what the fix does.
- Copy the CSS example further down and apply the same move to your own page.
Tips
- Squint at your page. Whatever still stands out is the top of your hierarchy; make sure it is the thing you want seen first.
- Pick one spacing scale, for example multiples of 4 or 8 pixels, and use only those values.
- Check text colours with a contrast checker instead of trusting your screen, which may be brighter than your visitors'.
- Fix proximity before adding borders. Space alone often groups things better than lines and boxes.
Frequently asked questions
What are the basic principles of web design?
The ones that matter most day to day are hierarchy, whitespace, contrast, alignment, proximity and comfortable tap targets. Consistency ties them together: the same spacing, type sizes and colours repeated across every page.
What is visual hierarchy in web design?
Visual hierarchy is the order in which people notice things on a page. Designers control it with size, weight, colour, position and space, so the headline is seen first, supporting details second and the main action is easy to find.
How much contrast does website text need?
WCAG 2.2 success criterion 1.4.3, level AA, asks for at least 4.5:1 for normal text and 3:1 for large text, which it defines as at least 18 point, or 14 point bold.
What is the F pattern in web design?
It describes how people often scan text-heavy pages: across the top, across again a little lower, then down the left side. The practical lesson is to put key words at the start of headings and lines, and not to bury important points mid-paragraph.
How big should buttons be on mobile?
WCAG 2.2 criterion 2.5.8 at level AA sets a minimum of 24 by 24 CSS pixels for pointer targets, with some exceptions such as links inside a sentence. Many design teams go larger for primary buttons so they are easy to hit.
Related: Colour contrast checker, Website accessibility checklist, Design system examples, How to design a homepage, Mobile-first web design.
Build your site free or see all free tools. On We.Inc you can build your site free, with no card and no trial needed to start. AI building is on paid plans from $19 a month.
More in Guides
- Web Design Proposal Template (Free Download + Filled Example) | How-to Guide
- 20 Web Dev Projects for Beginners (with Starter Code)
- Web Font Loading: font-display, Preload and Subsetting
- Web Push Notifications, Explained
- Web Safe Email Fonts and the Stacks to Use
- Webhook vs API: When to Pull and When to Be Pushed
- WebRTC vs WebSocket: Peers or a Server
- Website Accessibility Checklist for Small Businesses (WCAG-Based) | How-to Guide
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App