Nothing is located in the production branch. Instead, switch to the other branches and view the commit history for annotations.
- point (pt)
- pixel (px)
- percent (%)
- em
- root em (rem)
- viewport width (vw)
- viewport height (vh)
- vw or vh, whichever is smaller (vmin)
- vw or vh, whichever is greater (vmax)
- default typographic sizes are based on a scale of 16px body copy.
| element | px | % | em |
|---|---|---|---|
| h1 | 32px | 200% | 2em |
| h2 | 24px | 150% | 1.5em |
| h3 | 18.72px | 117% | 1.17em |
| h4 | 16px | 100% | 1em |
| h5 | 13.28px | 83% | 0.83em |
| h6 | 10.72px | 67% | 0.67em |
| body | 16px | 100% | 1em |
- pt. Points are 1/72 of an inch.
- px. Pixels are 1/96th of an inch. According to the CSS specification, "The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm’s length." With high-DPI devices, such as the 2x or even 3x Retina screens on iPhones, iPads, and some Macs, we need to understand the difference between a hardware pixel and the CSS reference pixel. For details, see The CSS Layout Workshop by Rachel Andrew.
Go deeper: view the W3C specification for absolute units.
- em. The width of a letter "m."
emis relative to the font size of its nearest ancestor. - rem. The "root em" is relative to the
font-sizeof thehtml, or root, element. - %. Percents are always relative to another value.
Go deeper: view the W3C specification for relative units.
The units below are relative to the viewport—not to a reader's default font size.
- vw. 1% of the width of the initial containing block.
- vh. 1% of the height of the initial containing block.
- vmin. The smaller of
vworvh. - vmax. The larger of
vworvh.
Go deeper: view the W3C specification for viewport relative units.