Summary CSS Font Sizes
Summary CSS Font Sizes
Read
https://medium.com/code‑better/css‑units‑for‑font‑size‑px‑em‑rem‑79f7e592bb97
https://snook.ca/archives/html_and_css/font‑size‑with‑rem
https://css‑tricks.com/books/volume‑i/scale‑typography‑screen‑size/
https://css‑tricks.com/rems‑ems/
https://css‑tricks.com/rem‑global‑em‑local/
https://csswizardry.com/2011/05/font‑sizing‑with‑rem‑could‑be‑avoided/
https://engageinteractive.co.uk/blog/em‑vs‑rem‑vs‑px
PX
best thought of as "device pixels" as this length doesn't have anything to do with the
literal screen pixels in the display you are looking at.
It's actually an angular measurement.
EM
A relative unit.
Originally a typographic measurement based on the current typefaces capital letter
"M".
em units multiply upon themselves when applied to font‑size
if an element with font‑size 1.1em is within an element with font‑size 1.1em within yet
another element with font‑size 1.1em, the resulting size is 1.1 ✕ 1.1 ✕ 1.1 == 1.331rem
REM
relative unit, like em, but it is always relative to the "root" element
Widely supported, in all modern browsers, even IE11.
VW / VH
"viewport width" or "height" unit.
1vw is equal to 1% of the width/height of the viewport.
Good support, only IE11 doesn't support vmax
vmin
This value will be whichever is smaller at the moment, vw or vh.
In the standard use case of sizing type, this may be a more useful metric than vw or
vh on their own in determining true screen size.
vmax
This value will be whichever is larger at the moment, vw or vh.
IE11 does not support vmax
%
based on the length of same property of the parent element
Ex
1ex would be equal to the computed height of the lowercase letter x of the root
element.
Ch
The ch unit is similar to the ex unit in that it will set the font‑size of an element in
relation to the width of the 0 (zero) glyph of the font: