Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First

A newspaper tells you where to look first. Learn the four tools of visual hierarchy, the 8-point spacing scale and proximity, then fix a cluttered workshop card by changing only its CSS.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Use size, weight, colour and position to give a screen one clear hero
  • Pick every gap from the 8-point scale: 8, 16, 24, 32, 48
  • Group related items with proximity: small gaps inside, big gaps between
  • Fix a cluttered card by changing only the CSS

Before you start

  • Basic HTML and CSS

Look at a newspaper front page for one second. You already know what to read first. The headline is the biggest, boldest thing on the page, so your eyes go there. The subheading is smaller and lighter and adds one detail. The small print comes last, and you only read it if you want more.

A screen works exactly the same way. You decide what is read first, second and last. That order is called visual hierarchy, and together with spacing it is the difference between a card that feels calm and one that feels like noise.

Four ways to make one thing stand out

You have four tools to build that order:

  • Size. Bigger things are read first.
  • Weight. Bold is heavier than light, so bold is read first.
  • Colour. A strong colour, like an accent blue, pulls the eye. Grey steps back.
  • Position. Top and left are read first. Bottom right is read last.

The trick is to use them on one thing only. If everything is loud, nothing is.

One card, two stylesheets

Here is a real example: a workshop card with a tag, a title, a date, a host, a short description, a price and a button. The HTML is the same for both versions:

<article class="card">
  <span class="tag">New</span>
  <h2 class="title">Weekend Design Workshop</h2>
  <p class="meta">Sat 14 March &middot; 10:00 &middot; Leeds</p>
  <p class="host">Hosted by Emma Clarke</p>
  <p class="desc">Learn to lay out a page so people know what to read first. Bring a laptop.</p>
  <div class="foot">
    <span class="price">$49</span>
    <button class="book">Book a seat</button>
  </div>
</article>

Now two stylesheets. First before.css, cluttered on purpose:

/* BEFORE: everything is the same size, weight and colour, and the gaps are random. */
.card { width: 380px; box-sizing: border-box; padding: 13px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; font: 600 16px/1.3 system-ui, sans-serif; color: #1e293b; }
.card .tag { display: inline-block; margin-bottom: 5px; }
.card .title { margin: 0 0 11px; font-size: 16px; }
.card .meta { margin: 0 0 3px; }
.card .host { margin: 0 0 19px; }
.card .desc { margin: 0 0 7px; }
.card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.card .price { font-size: 16px; }
.card .book { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 4px; background: #e2e8f0; font: inherit; color: #1e293b; }

Every text is 16px, the same weight and the same colour. The gaps are random: 13 here, 5 there, 11, 3, 19. Where do you look? Nowhere in particular.

And after.css:

/* AFTER: one thing is big, the rest is quiet, and every gap is a multiple of 8. */
.card { width: 380px; box-sizing: border-box; padding: 24px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; font: 400 16px/24px system-ui, sans-serif; color: #334155; }
.card .tag { display: inline-block; margin-bottom: 8px; font-size: 14px; font-weight: 700; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: #4f46e5; }
.card .title { margin: 0 0 8px; font-size: 28px; font-weight: 800; line-height: 32px; color: #0f172a; }
.card .meta { margin: 0; color: #64748b; }
.card .host { margin: 0 0 24px; font-size: 14px; color: #64748b; }
.card .desc { margin: 0; }
.card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }
.card .price { font-size: 32px; font-weight: 800; line-height: 40px; color: #0f172a; }
.card .book { height: 48px; padding: 0 24px; border: 0; border-radius: 8px; background: #4f46e5; font: 700 16px system-ui, sans-serif; color: #fff; cursor: pointer; }
.card .book:hover { background: #4338ca; }
Two versions of the Weekend Design Workshop card. Left: all text the same size and weight with uneven gaps and a grey button. Right: a small indigo NEW tag, a large bold title, quiet grey date and host, a big $49 price and a solid indigo Book a seat button.
Same HTML. Left is before.css, right is after.css.

The title comes first, then the price, then the button. The date, place and host stay quiet in grey. Same words, but now there is an order. The HTML did not change at all. Only the CSS did.

Every gap is a multiple of 8

Designers use a simple rule for spacing called the 8-point grid: every gap, every padding and every margin is a multiple of 8.

The 8-point spacing scale 8inside a group 16between close items 24card padding, between groups 32between sections 48a roomy page
Pick from the scale: 8, 16, 24, 32, 48. Never 13 or 17. Bars are drawn at four times the value.

Check after.css against it. The card padding is 24. The tag has 8 below it, the title 8, the host 24, and the price row 24 above it. Even the line height is 24px, and the button is 48px tall. Every value lands on the scale, so the card feels calm and tidy, even if you cannot say why. This takes the guesswork out of spacing.

Close together means related

One more idea, and it is a very important one: proximity. Take a checkout panel with a delivery address and a payment card.

Equal gaps versus grouped gaps Same gap everywhere Delivery Jack Miller 12 Oak Street Payment Visa ending 4242 16px16px16px16px Small inside, big between Delivery Jack Miller 12 Oak Street Payment Visa ending 4242 8px8px32px8px
Left: every line 16 apart, so you have to read it all. Right: 8 inside a group, 32 between groups.

On the left, nothing looks grouped. You have to read every line to find out what belongs together. On the right you see two groups, delivery and payment, without reading a word. The rule is simple: related things close, unrelated things far.

Four changes fix the cluttered card

Back to the workshop card. Going from before.css to after.css is four steps:

  1. Pick the hero. .title { font-size: 28px; } and bold. Right away, the eye knows where to start.
  2. Quiet the rest. .meta { color: #64748b; }. The date, host and description turn grey and lighter. The tag becomes small capitals, and the price and the button get their own strength.
  3. Use the 8 scale. .card { padding: 24px; }, and every margin becomes 8, 16 or 24.
  4. Group by distance. .foot { margin-top: 24px; }. The details stay close together, and the price row gets room above it.

Four small changes, and the HTML stayed the same.

Common mistakes

  • Two heroes. A huge title and a huge price and a bright button all fighting. Pick one first, one second.
  • Grey everything. Quiet details are good. Quiet buttons are not. The main action needs its own strength.
  • Odd numbers that "look right". 13px here and 17px there feels fine on one card and messy across an app. Take the value from the scale.
  • Equal gaps everywhere. Equal spacing hides the groups. Use a small gap inside and a big gap between.

Run this check on every screen

One hero per screen. Quiet details. One main button. Gaps from 8, 16, 24, 32. Related items close together. You can give the same check to AI. Paste this into your prompt:

Review this screen: what is the first thing the eye reads? Is there one clear primary action? Are all spacing values multiples of 8? Are related items closer to each other than to unrelated ones? List what to fix, then fix it.

Recap

IdeaRule
HierarchyOne hero, built with size, weight, colour or position
SpacingMultiples of 8: 8, 16, 24, 32, 48
ProximityClose means related, far means separate

You do not have to memorise every value. Learn these foundations so you know what to ask for, and AI can generate the rest. To review a whole AI-built screen, use the six-check critique. Next, the same thinking applied to colour in colour, contrast and dark palettes.

Keep going in React · 21 of 59

Previous
Why AI-Built Websites All Look the Same, and Four Levels That Fix It
Next post
Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

On this page

  • Four ways to make one thing stand out
  • One card, two stylesheets
  • Every gap is a multiple of 8
  • Close together means related
  • Four changes fix the cluttered card
  • Common mistakes
  • Run this check on every screen
  • Recap
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.