Lesson 6 of 8
Numbers that line up
- 10 min
- 4 checks
- 3 hints
- Go to task
Goal
Equal-width digits in tables
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.
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- The .num cells use tabular figures
- Every digit has the same width
- The decimal points line up
- The paragraph under the table keeps its proportional figures