Sub topic 5
Comparing with Overlays and Side-by-Side Views
This chapter assumes you can open browser DevTools, read a Figma frame or a PDF spec, and have prepared a fair comparison (same browser, viewport width, zoom and pixel density). Measuring with DevTools tells you the value of one property at a time. Overlay and side-by-side comparison shows you where the whole page drifts from the design, so you know which properties to measure next.
What these methods are for
Overlay and side-by-side views are detection tools. They find differences quickly. They do not tell you the cause or the correct value. After you spot a difference, confirm it with DevTools and the design spec before you report it.
| Method | Best for | Weak at |
|---|---|---|
| Overlay with opacity | Position drift, wrong widths, misaligned edges | Small color or font-weight changes |
| Difference blend | Finding every changed pixel at once | Telling you which difference matters |
| Side-by-side | Overall impression, hierarchy, color, weight | Exact pixel offsets |
| Flicker (toggle) | Small shifts in position or size | Hard to describe the result in a report |
Preparing the two images
A comparison is only as good as its inputs. Before you overlay anything, check these points.
- Export the design frame at the same width as the browser viewport. A 1280 px frame compared with a 1280 px viewport gives a 1:1 match.
- Match the pixel density. A design exported at 2x is twice as many pixels wide as the 1x screenshot. Scale one to match the other, or take the screenshot at the same device pixel ratio.
- Use the same state. If the design shows a menu open or a form filled in, put the page in that state first.
- Use the same content. If the design uses placeholder text and the page shows real text, line breaks will differ and everything below them will shift. Note this before you blame the layout.
- Capture the page without browser chrome. Use the DevTools "Capture screenshot" or "Capture full size screenshot" commands from the command menu, not an operating-system screenshot.
Overlay with opacity
The classic method places the design image on top of the live page at partial opacity, so you see both at once. You can do this without any extension by adding a temporary element to the page from the DevTools console.
const overlay = document.createElement('img');
overlay.src = 'https://example.com/design/home-1280.png'; // URL of your exported frame
overlay.id = 'qa-overlay';
Object.assign(overlay.style, {
position: 'absolute',
top: '0',
left: '0',
width: '1280px', // the frame's width at 1x
opacity: '0.5',
pointerEvents: 'none', // clicks pass through to the page
zIndex: '99999',
});
document.body.appendChild(overlay);Some sites block images from other origins, or serve a policy that stops the console from loading them. If that happens, serve the image from a local static server, or use a browser extension built for overlays.
To remove it, run document.getElementById('qa-overlay').remove().
Set pointerEvents to none. Without it, the overlay captures your clicks and you cannot interact with the page underneath.
Reading an overlay
At 50% opacity, text that is aligned looks crisp. Text that is offset looks doubled, like a ghost. Look for these patterns:
- A constant offset on everything usually means the page has a different left margin, scrollbar width or container padding.
- An offset that grows down the page usually means a vertical spacing value is slightly wrong and repeats. A 4 px error across 20 sections becomes 80 px.
- An offset that starts at one element and continues from there means that element has the wrong height or margin. Everything after it inherits the error.
That last pattern is the most useful one. Find the first element where the ghost appears, and start your measurements there.
Difference blend
CSS has a mix-blend-mode property. With the value difference, pixels that are the same turn black, and pixels that differ turn bright. This is a quick way to see every change at once.
const overlay = document.getElementById('qa-overlay');
overlay.style.opacity = '1';
overlay.style.mixBlendMode = 'difference';The result is mostly black, with bright outlines where text, edges or colors disagree. A few cautions:
- Anti-aliasing (the smoothing of edges) differs between a design tool and a browser. Expect faint outlines around all text even when the match is correct. Look for strong, solid shapes, not thin halos.
- Images and gradients often show noise from compression. Ignore it unless the shape itself has moved.
- A solid bright block means a real color or size difference. Check it.
Side-by-side views
Side-by-side comparison puts the design and the page next to each other. It is weaker for measuring and stronger for judging. Your eye is good at noticing that one heading feels heavier, or that one section feels more cramped.
Set it up in one of two ways:
- Two windows, one with the design and one with the page, at the same zoom and scroll position.
- A single image editor or comparison tool with both images on one canvas, aligned at the top left.
Scroll both views in step, section by section. Compare the same region at the same time, for example the header, then the hero, then the first card row.
Flicker comparison
Toggle between the two views quickly, by switching tabs or switching layer visibility, and watch what moves. Your eye picks up motion very well. A button that jumps 3 px or a heading that changes weight shows up at once. This method is fast for finding differences. It is poor for communicating them, so take a note or screenshot of what you saw.
A workflow that combines them
Work section by section. A whole-page overlay of a long page is hard to read, because small offsets accumulate. Reset your reference at each major section by lining up the top of that section in both images.
Common errors
- Comparing at different widths. A page at 1263 px against a 1280 px frame will never line up. Check the viewport size in DevTools before you start.
- Ignoring the scrollbar. A classic scrollbar takes about 15 px from the viewport width on some systems. The page content area is narrower than the window, which shifts centered content.
- Treating placeholder text as a bug. If the copy differs, line wraps differ. Compare structure and styles, not wrapping.
- Trusting the overlay over the spec. Designs sometimes contain small errors, such as a 15 px gap where the spec says 16 px. If the spec and the image disagree, ask the designer.
- Leaving the overlay in the page. Remove it before you take screenshots for reports, or the screenshot shows the overlay.
Limits of the visual methods
These methods cannot see behavior. They compare a still image. They do not show hover transitions, focus order, or what happens when text is longer. They also cannot see values that look the same but differ, such as a color that is #333333 in the design and #343434 in the build. For exact values, go back to DevTools and the design tokens.
Exercise
You overlay a 1280 px design frame at 50% opacity on the page. The header lines up exactly. The hero heading is offset downward by 6 px, and every section below it is offset by the same 6 px. Where do you start measuring, and why?
Show answer
Start with the hero heading, or the element just above it, because the offset first appears there and everything after it simply inherits the error. Measure the hero's top margin or padding, the heading's line height, and the height of any element between the header and the heading in DevTools, then compare them with the spec. Measuring the lower sections would only confirm the same inherited 6 px.
Exercise
You switch the overlay to mix-blend-mode: difference and see thin bright outlines around all the text, but the layout shapes are black. Is this a failure? What would count as a real finding?
Show answer
No. Thin outlines around text are normal, because a design tool and a browser anti-alias text differently. A real finding is a solid bright shape, such as a filled block where a button color differs, or a doubled edge where an element has moved or changed size. Confirm any such finding with DevTools before reporting it.