Skip to content

saulbaizman-teaching/units-of-measure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

units of measure demo

Nothing is located in the production branch. Instead, switch to the other branches and view the commit history for annotations.

demo index

default type measurements

  • 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

absolute units

fonts

  • 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.

relative units

fonts

  • em. The width of a letter "m." em is relative to the font size of its nearest ancestor.
  • rem. The "root em" is relative to the font-size of the html, or root, element.
  • %. Percents are always relative to another value.

Go deeper: view the W3C specification for relative units.

the viewport

The units below are relative to the viewport—not to a reader's default font size.

Go deeper: view the W3C specification for viewport relative units.

About

Demo to illustrate the most common units of measurement on the web.

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •