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.
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:
- A red “SALE” badge, a red “Only 3 left” label and a red “Free delivery” banner. Now red means nothing.
- Five different font sizes and almost everything in bold.
- The price is the same size as the product code.
- 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.
- 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.
- 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.
- 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.
- 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.
Two quick checks
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- Use one or two typefaces. One family with a few weights is often enough.
- 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.
Spacing
Space is not empty. It shows which things belong together.
- The law of proximity. Elements that are close to each other look related. This comes from Gestalt psychology.
- 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.
- 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.
- Spacing is a token. In the design system, “space md” is 16 pixels, and designers and engineers use the same name.
Grids
A layout grid gives every screen the same structure: columns, gutters (the spaces between columns) and margins (the space at the edges).
- 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.
- 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).
- 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.
Colour and contrast
Colour has a job
- 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.
- 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.
- 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.
- 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:
- Normal text: at least 4.5 to 1 against its background.
- Large text: at least 3 to 1.
- 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”.
- Map the same semantic tokens to dark values. “Surface” becomes a dark grey, “text” becomes a light grey.
- Check contrast again. A colour that works on white often looks too bright or too weak on a dark grey.
- Look at real photos. Product photos on white backgrounds may look like white boxes on a dark page.
Consistency
- 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.
- 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.
- Use the design system. Most consistency problems are decisions made again and again in different places.
- 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
- Hierarchy is the order in which people notice things. Decide the order before choosing colours.
- Show the order with size, weight, colour, position and space, and use the strongest style for one thing.
- Use a small type scale, readable line length and enough line height, and test with real text.
- Space shows what belongs together: inner space is smaller than outer space. Use a spacing scale.
- A grid with columns, gutters and margins keeps screens aligned, and it changes with the screen size.
- Give each colour a role, never use colour alone, and meet the contrast minimums: 4.5 to 1 and 3 to 1.
- Be consistent everywhere, and break consistency only on purpose, for the most important thing.