Lesson 6 of 8

Numbers that line up

Goal

Equal-width digits in tables

01

Explanation

Many fonts give each digit its natural width, so a 1 is narrower than an 8. Nobody notices in a regular paragraph, but in a table the digits don't line up under each other, and in a counter that keeps changing, the text jitters with every new number.

font-variant-numeric: tabular-nums asks the font for its tabular figures, digits that all share one width, so ones line up under ones and decimal points under decimal points.

The trap is trusting your eyes. Some system fonts use tabular figures by default, so you see no difference on your machine while a reader on another device does. Write the property explicitly, and put it on the number cells only, because proportional figures, where each digit takes its natural width, are easier on the eye inside paragraphs.

02

Your task

Make the digits in the .num cells tabular, and leave the .note paragraph under the table with its proportional figures.

Checks

4 checks
  1. The .num cells use tabular figures
  2. Every digit has the same width
  3. The decimal points line up
  4. The paragraph under the table keeps its proportional figures
03

Hints

0/3
Track lessons0 of 8 done

Learn to scale headings, choose the right units, and set line length and text direction, because text is what people read most in any interface.

Beginner level, 8 lessons, 1.5 hours in total.

index.html
Preview
index.html100%
–/4

Press “Run and check” to grade your code.

4 checks listed under “Your task”.

Track lessons0 of 8 done

Learn to scale headings, choose the right units, and set line length and text direction, because text is what people read most in any interface.

Beginner level, 8 lessons, 1.5 hours in total.