Sub topic 2
Treating the design as the reference: specs, tokens and redlines
This chapter assumes you can read basic HTML and CSS (box model, selectors, units), open browser DevTools, and open a design file such as a Figma frame or a PDF style guide. It covers how to turn the design into a reference you can check a page against. The later chapters on layout, typography and color depend on it.
Why the design has to be pinned down first
A visual QA pass compares two things: the built page and the design. If the design is vague, every difference becomes an argument. "The button looks a bit off" gives the developer nothing to act on. "The button padding is 12px 20px, the spec says 12px 24px" does.
Before you open DevTools, decide what counts as the reference and what you will do when it is silent or contradicts itself. Most disputes in a QA pass come from skipping this step.
The parts of a design reference
A design usually reaches you as several artifacts. Each answers a different question.
| Artifact | What it tells you | Typical weakness |
|---|---|---|
| Design frames (Figma, Sketch, XD) | Layout, hierarchy, how things look at one width | Show one state and one width; sample text is often short and tidy |
| Specs or redlines | Exact sizes, gaps, offsets | Can go stale after design edits; may be missing for some components |
| Design tokens | Named values for color, spacing, type, radius, shadow | Names can differ between design tool and code |
| Style guide or component library | Rules and approved variants | May describe the ideal, not what was handed off for this project |
| Prototype and annotations | Interaction, motion, state changes | Notes are easy to overlook, and prototypes may skip edge cases |
Treat these as layers. Frames show intent. Tokens and specs give numbers. Annotations explain behavior. A complete check uses all of them.
Design tokens
A design token is a named value that stands for a design decision, such as color.brand.500 instead of #0B5FFF. Tokens matter in QA because they tell you which value is intended, not only what a pixel looked like in an export.
Tokens are often exported as JSON from the design tool:
{
"color": {
"text": { "primary": "#1A1A1A", "muted": "#595959" },
"brand": { "500": "#0B5FFF", "700": "#0842B8" }
},
"space": { "1": "4px", "2": "8px", "3": "12px", "4": "16px", "6": "24px" },
"font": {
"body": { "family": "Inter", "size": "16px", "lineHeight": "24px" },
"h1": { "family": "Inter", "size": "40px", "lineHeight": "48px", "weight": "700" }
},
"radius": { "md": "8px" }
}The front-end team usually turns these into CSS custom properties:
:root {
--color-text-primary: #1a1a1a;
--color-text-muted: #595959;
--color-brand-500: #0b5fff;
--color-brand-700: #0842b8;
--space-2: 8px;
--space-4: 16px;
--space-6: 24px;
--radius-md: 8px;
}
.btn-primary {
background: var(--color-brand-500);
padding: var(--space-3, 12px) var(--space-6);
border-radius: var(--radius-md);
}This gives you two ways to check a value. First, compare the rendered value with the token's value. Second, check whether the code used the token at all. A button with a hard-coded #0C60FF looks right today, but it will drift when the brand color changes. Report that as a lower-severity maintainability issue, not as a visual bug.
You can compare a rendered color with a token from the console. Computed colors come back as rgb(...) strings, so the script converts the token to the same form first:
function checkColor(selector, property, tokenName) {
const probe = document.createElement('span');
document.body.append(probe);
probe.style.color = getComputedStyle(document.documentElement)
.getPropertyValue(tokenName)
.trim();
const expected = getComputedStyle(probe).color;
probe.remove();
const actual = getComputedStyle(document.querySelector(selector))[property];
console.log({ selector, property, expected, actual, match: expected === actual });
}
checkColor('.btn-primary', 'backgroundColor', '--color-brand-500');Reading redlines
A redline (also called a spec overlay) is a design marked up with measurements: widths, heights, gaps between elements, and padding inside them. Design tools can generate them, and some teams export them as PDFs.
Keep these points in mind when you read them:
- Check the frame scale. A mobile frame drawn at 375 wide is at 1x. An export labelled 2x doubles every number.
- Distinguish padding (inside the box) from margin or gap (between boxes). A redline showing "16" between two cards does not say which CSS property produces it.
- Look at line-height boxes. A text layer's measured height includes line height. The visible gap between a heading's letters and the next element is therefore larger than the spec number.
- Expect rounding. A design with a 33.33% column at 1280px gives 426.67px. A built page can differ by a fraction of a pixel with no real problem.
- Note whether sizes are fixed or flexible. A redline at one width cannot tell you whether a card is meant to stay 320px or stretch. Look for constraints, auto-layout settings or annotations.
Build a reference sheet
Instead of flipping between the design and the page for every element, collect the expected values in one place before you start. A small table per component works well:
| Element | Property | Expected | Source |
|---|---|---|---|
| Page heading | font-size / line-height | 40px / 48px | Token `font.h1` |
| Page heading | color | #1A1A1A | Token `color.text.primary` |
| Primary button | padding | 12px 24px | Redline, frame "Home / 1280" |
| Primary button | border-radius | 8px | Token `radius.md` |
| Card grid | gap | 24px | Redline, frame "Home / 1280" |
The source column matters. When a developer disagrees, you can point to where the number comes from, and if that source turns out to be wrong, you can see which other values depend on it.
When the reference is silent or wrong
The design will not cover everything. Decide in advance how you treat each case:
- Missing state or width. The design has no tablet frame or no error state. Do not invent a requirement. Record it as a question to the designer and check whether the built page at least follows the nearest frame sensibly.
- Conflicting sources. A redline says 20px and the token says 24px. Find out which is newer. Ask the designer, and do not guess from which one looks better.
- Design tool artifacts. Design files sometimes use fixed text boxes, placeholder fonts or images with baked-in text that cannot be built exactly. Treat these as questions, not defects.
- The design is wrong. Sometimes the build is reasonable and the design has the flaw, for example a text color that fails contrast. Report it as a design issue, not a build issue, so it reaches the right person.
The diagram below shows the order of lookup when a value is in question.
Tolerance and versioning
Agree on a tolerance before you start. A common choice is exact match for tokens and colors, and about 1px for measured layout values. Write the tolerance in the reference sheet so that it does not change midway through the pass.
Also record the version of the design you checked: the file version, the date, or the handoff tag. Designs change during a build, and a report that does not name its version may be answered with "that was updated last week". If the design changes during your pass, update the reference sheet and note which findings you checked against the old version.
Exercise
A redline shows 16px between a card image and its title. The token file lists space.4 as 16px. In DevTools, the built page shows the title's margin-top as 0 and the image's margin-bottom as 16px. Is this a discrepancy? What else would you check in the reference before reporting it?
Show answer
Not necessarily. The rendered gap is 16px, which matches the redline and space.4, and the redline does not say which property creates it. Before reporting anything, check whether the code uses the token (var(--space-4)) or a hard-coded 16px, and whether the gap is the same in the other frames. If it is hard-coded, note it as a low-severity maintainability issue, not a visual one.