Setting font-size
does not change the way the em
unit works.
If you set p {font-size: 1em}
, then, with the usual CSS Caveats (other style sheets might set font-size
on p
, etc.), the font size in any p
will be equal to the font size of its parent, which is what happens by default anyway via inheritance (when no style sheet sets font-size
on the p
element).
If a p
element is a child of body
and you have set body {font-size: 10px}
, then, with the Caveats, the p
element’s font size will be 10 CSS pixels. The size of a CSS pixel depends on the device and need not equal physical device pixel; see 5.2. Absolute lengths: the ‘cm’, ‘mm’, ‘in’, ‘pt’, ‘pc’, ‘px’ units in CSS Values and Units Module Level 3 CR (which is more realistic than CSS 2.1).