CKTIS / CSS
font-size — font size
The font-size property sets the font size and is inherited. Percentages and em in this property refer to the parent's font size, while rem refers to the root element's font size.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
font-size: <absolute-size> | <relative-size> | <length-percentage [0,∞]> | math;font-size sets the font's scale, not the exact height of visible characters. Its initial value is medium; the property is inherited.
It accepts nonnegative lengths and percentages, the keywords xx-small, x-small, small, medium, large, x-large, xx-large, xxx-large, and the relative keywords larger and smaller. math invokes special mathematical scaling rules; its support needs separate checking in the target browser.
In font-size, % and em refer to the parent's computed font size; rem refers to the root element's font size. Nested percentage or em declarations can compound. On the root element, these units use the initial value instead of creating a circular dependency.
In the example, 150% of 20px gives 30px. These are expected computed values, not measured character heights; the example requires local verification.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>font-size</title>
<style>
.parent { font-size: 20px; }
.child { font-size: 150%; }
</style>
<div class="parent">
Parent
<div class="child">Child</div>
</div>
</html>Result
.parent: 20px .child: 30px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.