My account

Visual design

Visual design decides what people see first, what belongs together, and whether they can read it at all. Build hierarchy with size, weight, colour and space. Use a small type scale, a spacing scale and a grid. Use colour for meaning and keep enough contrast. Be consistent, and break consistency only on purpose, for the one thing that matters most.

Not reviewedWritten with AI helpReading time: 15 minOnline shop exampleHierarchyTypographyContrast

Author: bezzad

Contents

The problem: everything is important

The product page of our online shop has grown over time. Every team added something it thought was important:

  1. A red “SALE” badge, a red “Only 3 left” label and a red “Free delivery” banner. Now red means nothing.
  2. Five different font sizes and almost everything in bold.
  3. The price is the same size as the product code.
  4. The “Add to cart” button has the same style as “Add to wishlist” and “Compare”.

Customers say the page is “busy” and they “cannot find the price”. When everything shouts, nothing is heard. Visual design is how you decide what is heard first.

Visual hierarchy

Hierarchy is the order in which people notice things. Decide this order before you choose any colour.

  1. List what matters on the screen, in order. For a product card: the photo, the product name, the price, then the “Add to cart” button. The rating and the badge come after.
  2. Use a few tools to show the order: size, weight (bold or regular), colour and contrast, position (top and left are often seen first in left-to-right languages), and space around an element.
  3. Use the strongest tools for the most important thing only. If the name, the price and the badge are all big and bold, none of them stands out.
  4. One primary action per area. “Add to cart” is a filled button. “Add to wishlist” is a quieter secondary button or an icon button with a name.
BeforeAfterSALEOnly 3 leftRunning Shoe Pro 2SKU 48213-B$79 (was $99)Rating 4.5 (120)Add to cartWishlistCompareSALERunning Shoe Pro 2Rating 4.5, 120 reviews$79$99Add to cart♡
The same product card twice. On the left, everything has the same weight, so the eye does not know where to go. On the right, the photo, the name, the price and one main button form a clear order.

Two quick checks

  1. The squint test. Look at the screen with half-closed eyes, or blur a screenshot. What do you still see? It should be the most important thing.
  2. The greyscale test. Look at the screen in black and white. If the hierarchy disappears, it depended only on colour. That is also a problem for people who see colour differently.

Typography

Most of an online shop is text: names, prices, descriptions, buttons, errors. Good typography makes it easy to read.

  1. Use a small type scale. Pick a few sizes and use only those. For example, each size about 1.25 times the size before it. A shop rarely needs more than five or six sizes.
  2. Body text must be easy to read. 16 CSS pixels is a common size for body text on the web, because it is the default size of most browsers.
  3. Keep lines a readable length. A common guideline from print design is about 45 to 75 characters per line. Very long lines make it hard to find the start of the next line.
  4. Give lines room. Body text usually needs more line height than headings. WCAG also asks that the content still works when a user sets the line height to 1.5 times the font size.
  5. Use one or two typefaces. One family with a few weights is often enough.
  6. Test with real text in every language. Persian text, long German words and product names with numbers all behave differently. A font that looks good in English may not support Persian well.
Light grey text is a common trap. Light grey text looks elegant in a design file on a good screen. On a phone in the sun it is hard to read, and it often fails the contrast minimum. Check every text colour.

Spacing

Space is not empty. It shows which things belong together.

  1. The law of proximity. Elements that are close to each other look related. This comes from Gestalt psychology.
  2. Inner space is smaller than outer space. A label must be closer to its own field than to the field above it. Otherwise people do not know which label belongs to which field.
  3. Use a spacing scale. Pick a base unit, often 4 or 8 pixels, and use only multiples of it: 4, 8, 12, 16, 24, 32, 48. Many teams call this an 8-point grid. It is not magic. It just stops every screen from having its own random numbers.
  4. Spacing is a token. In the design system, “space md” is 16 pixels, and designers and engineers use the same name.
Spacing scale (base 4)481216243248UnclearClearEmailPhoneEmailPhoneInner space is smaller than outer space.
A spacing scale built on a base of 4, and the law of proximity. In the unclear form, the Phone label sits halfway between two fields. In the clear form, it is clearly closer to its own field.

Grids

A layout grid gives every screen the same structure: columns, gutters (the spaces between columns) and margins (the space at the edges).

  1. Elements line up. Product cards, filters and the header all start and end on the same lines. The page looks calm and is easier to scan.
  2. The grid changes with the screen size. For example, many systems use 4 columns on phones and 12 columns on large screens. A product card can span 2 of 4 columns on a phone (two cards in a row) and 3 of 12 on a desktop (four cards in a row).
  3. Design the breakpoints, not only one screen. Show what happens on a phone, a tablet and a wide desktop. Engineers should not have to guess.
Phone: 4 columns, each card spans 2Desktop: 12 columns, each card spans 3
The same product list on a phone with 4 columns and on a desktop with 12 columns. Each card spans 2 columns on the phone and 3 columns on the desktop.

Colour and contrast

Colour has a job

  1. Give each colour a role, not only a shade: primary action, text, muted text, surface, border, success, warning, danger. These roles are the semantic tokens of the design system.
  2. Keep a strong colour for few things. If the accent colour is on every badge and banner, it no longer points to the main action.
  3. Keep meanings stable. If red means “error” in checkout, do not use red for “sale” next to it. Customers learn the meaning of a colour from the product.
  4. Do not use colour alone. An error needs a text message and maybe an icon, not only a red border. Some people cannot tell red from green.

Contrast

The WCAG rules for contrast at level AA, the level most teams aim for, are:

  1. Normal text: at least 4.5 to 1 against its background.
  2. Large text: at least 3 to 1.
  3. Interface parts and meaningful graphics (a field border, a focus ring, an icon without text): at least 3 to 1.

The accessibility lesson explains these numbers in more detail. For visual design the main point is: check contrast while you design, not at the end. A brand colour that fails on white needs a darker version for text.

Dark mode

Dark mode is not “invert all colours”.

  1. Map the same semantic tokens to dark values. “Surface” becomes a dark grey, “text” becomes a light grey.
  2. Check contrast again. A colour that works on white often looks too bright or too weak on a dark grey.
  3. Look at real photos. Product photos on white backgrounds may look like white boxes on a dark page.

Consistency

  1. The same thing looks and works the same everywhere. If “Add to cart” is a filled button on the product page, it is not a link on the search page.
  2. Follow platform conventions. People bring habits from other shops and apps. The cart icon in the top corner is a convention. Do not move it to look different.
  3. Use the design system. Most consistency problems are decisions made again and again in different places.
  4. Break consistency on purpose. The one thing that must stand out, like the main “Pay” button, can be the only element with the strongest style. That works only because everything else is consistent.

Common mistakes

Mistake Result Better way
Everything bold and big Nothing stands out. Decide the order first, then use strong styles for one thing.
Many font sizes A noisy, unplanned look. A small type scale.
Light grey text Hard to read, fails contrast. At least 4.5 to 1 for normal text.
Equal space everywhere People cannot see what belongs together. Inner space smaller than outer space.
Random spacing numbers Every screen is a little different. A spacing scale as tokens.
Colour as the only signal Some people miss errors and states. Add text or an icon.
The accent colour on every badge The main action gets lost. Keep the accent for the main action.
Dark mode by inverting colours Bad contrast and strange photos. A second mapping of semantic tokens, checked again.

Summary in 7 lines

  1. Hierarchy is the order in which people notice things. Decide the order before choosing colours.
  2. Show the order with size, weight, colour, position and space, and use the strongest style for one thing.
  3. Use a small type scale, readable line length and enough line height, and test with real text.
  4. Space shows what belongs together: inner space is smaller than outer space. Use a spacing scale.
  5. A grid with columns, gutters and margins keeps screens aligned, and it changes with the screen size.
  6. Give each colour a role, never use colour alone, and meet the contrast minimums: 4.5 to 1 and 3 to 1.
  7. Be consistent everywhere, and break consistency only on purpose, for the most important thing.

Done reading this lesson?Mark it as finished so it shows in your lessons list and report card.