Sub topic 7
Typography: fonts, sizes, weights and line height
This chapter assumes you can open DevTools, read the Computed pane, and understand CSS units such as px, rem and em. It also assumes you can read a type spec in a design file. You already have a fair comparison set up (same browser, viewport, zoom and pixel density) and know how to pick elements in DevTools. Here you will check the text itself.
Typography is where small mismatches add up. A heading that is 2px too small or a line height that is slightly too tight rarely looks broken on its own. Together they make a page feel "off" even when the layout is correct.
What to compare
For each text style in the design, check these properties on the built page:
| Property | CSS property | Common mismatch |
|---|---|---|
| Font family | `font-family` | Fallback font renders because the web font failed to load |
| Size | `font-size` | Design value in px, build value in `rem` that resolves differently |
| Weight | `font-weight` | Weight 500 requested, but only 400 and 700 are loaded |
| Line height | `line-height` | Design gives pixels, build uses a unitless ratio, or the reverse |
| Letter spacing | `letter-spacing` | Design uses a percentage, build uses `em` or `px` |
| Color | `color` | Slightly different gray, or inherited from the wrong parent |
Work from the design's text styles, not from individual screens. Most designs define a small set (for example Heading 1, Body, Caption). Verify each style once in a representative place, then check that every usage actually applies it.
Read computed values, not authored values
The Styles pane shows what the author wrote, such as font-size: 1.125rem. The Computed pane shows what the browser resolved, such as 18px. Compare the computed value with the design. You can also read the values from the console:
const el = document.querySelector('h1');
const s = getComputedStyle(el);
console.log({
fontFamily: s.fontFamily,
fontSize: s.fontSize,
fontWeight: s.fontWeight,
lineHeight: s.lineHeight,
letterSpacing: s.letterSpacing,
color: s.color
});Note that getComputedStyle reports the declared font family list, not the font that was actually used. A page can declare "Inter", sans-serif and still render in a fallback. To see the real font, open the Rendered Fonts section at the bottom of the Computed pane (Chrome and Edge, or the Fonts tab in Firefox). It lists each font the browser used and whether it was a local or a network font.
Fonts: family, files and loading
Check the following when the family looks wrong:
- Is the file requested and does it succeed? In the Network tab, filter by Font and look for status 200. A failed request means the fallback is showing.
- Is the right weight and style loaded? Each
@font-facerule maps a weight to a file. If the design uses weights 400, 500 and 700 but only 400 and 700 are declared, a request for 500 renders as 400. This is a very common cause of "the headings look too light". - Is it faux bold or faux italic? If the font has no bold file, the browser may synthesize a thicker version. It looks smeared compared with a true bold. Compare the letter shapes against the design at high zoom.
- Does a flash of fallback text appear? With
font-display: swap, text shows in the fallback first and then switches. Reload with throttled network and watch for layout jumps when the swap happens.
Also compare the fallback stack. If the design font cannot load, a fallback with very different metrics causes the text to reflow. This is a content shift problem you should report separately from a wrong-font problem.
Sizes: px, rem and what the design means
Designers usually specify sizes in px. Developers often use rem, where 1rem equals the root font size (16px by default). The values should resolve to the same pixels at the default setting. Check the computed value, not the source.
Watch for these edge cases:
- Nested
emvalues.emis relative to the parent's font size, so aneminside anotheremcompounds. A list inside a card inside a section can end up at an unexpected size. - Fluid type. If the build uses
clamp()or viewport units, the size changes continuously with the viewport. Compare at the exact widths the design shows, and confirm the minimum and maximum values at the extremes. - Rounded values. A design value of 17.6px may compute to 17.6px in the browser and render fine. Report only differences that exceed your agreed tolerance, for example 1px.
Line height
Line height is the most often mismatched property, because tools express it differently. A Figma text style may show 24px, a percentage such as 150%, or "Auto". In CSS, a unitless value like 1.5 multiplies the element's own font size and is inherited as the ratio. A value with units, such as 24px, is inherited as a fixed length.
Convert before comparing. For a 16px font:
- Design line height 24px equals ratio 1.5.
- Design line height 150% equals ratio 1.5.
- Design "Auto" depends on the font's built-in metrics and rarely equals a clean number, so measure it in the design instead.
To measure the built line height, select a multi-line paragraph and check the computed line-height. If it says normal, the browser is using the font's own metrics, which differ between fonts. That usually means no line height was authored. You can confirm visually by turning on an outline and checking the height of a single line box:
/* Paste into DevTools or a temporary stylesheet to see every element's box */
* {
outline: 1px solid rgba(255, 0, 0, 0.4);
}The outline does not change layout, so spacing stays accurate. Each inline box shows its own height, and you can compare the gap between lines with the design.
Weights, letter spacing and rendering differences
Weight names are not consistent across tools. In CSS, font-weight: 600 is numeric, while a design file may say "SemiBold". Map names to numbers (Regular 400, Medium 500, SemiBold 600, Bold 700) and check that the loaded font file supports that weight. A variable font can render any value in its range, while a static font only offers fixed steps.
Letter spacing is often given in design tools as a percentage of font size. CSS needs em or px. A letter spacing of 2% on a 16px font is 0.02em, or about 0.32px. Differences this small are visible only in uppercase labels or tight headings, so check those first.
Do not report small rendering differences between the design tool and the browser. Antialiasing, subpixel positioning and hinting vary by operating system and display. If the glyph shapes, weight and metrics match, a faint difference in sharpness is not a defect.
Text wrapping
Wrapping reveals problems that single values hide. Compare where lines break in the design and in the build at the same container width. A different break usually means one of the following:
- The container is narrower or wider than the design (check the layout, not the type).
- The font size, letter spacing or font itself differs slightly.
- The build lacks a
max-widthortext-wrapsetting the design assumed.
Count the lines. A heading that takes three lines instead of two pushes everything below it down, so it is worth reporting even when each individual property looks right.
A repeatable procedure
- List the text styles in the design with family, size, weight, line height, letter spacing and color.
- Convert design values to CSS units (px to computed px, percent line height to a ratio).
- For each style, inspect one element in DevTools and record the computed values and the Rendered Fonts list.
- Check that every other element using that style gets the same values, by sampling headings, buttons, form labels and captions.
- Compare line breaks at the design's widths.
- Log each difference with the measured and expected values.
Color of text is covered with contrast in the next part of the pass, so only note here whether the color token is the right one.
Exercise
A design specifies body text as Inter, 16px, weight 500, line height 24px. In the build, the computed values are font-family "Inter", sans-serif, font-size 16px, font-weight 500, line-height 1.5. The text still looks lighter than the design. What do you check next, and why are the line height values not the problem?
Show answer
Line height 1.5 on 16px text equals 24px, so it matches. The family string only shows what was declared, so open Rendered Fonts and the Network tab to see whether Inter loaded and whether a 500 weight file exists. If only 400 and 700 are declared in @font-face, the browser renders 500 as 400, which explains the lighter look. Fix by loading the 500 weight or a variable font.
Exercise
A heading uses a nested em value and renders at 21.6px, but the design says 18px. Name one way to find the cause in DevTools.
Show answer
Select the heading and look at the computed font-size, then walk up the parent elements in the Elements panel and check each ancestor's computed font-size. An em on the heading is multiplied by the parent's size, so an ancestor with a larger or em-based size explains the compounding.