We use cookies to improve your experience. Learn more in our Privacy policy.
font-size
The font-size CSS property sets the size of the font. Changing the font size also updates the sizes of the font size-relative
Example
Initial value | medium |
Applies to | all elements. It also applies to ::first-letter and ::first-line. |
Syntax
font-size: 1.2em;
Values
Absolute-size keywords, based on the user's default font size (which is medium).
Relative-size keywords. The font will be larger or smaller relative to the parent element's font size, roughly by the ratio used to separate the absolute-size keywords above.
A positive value. For most font-relative units (such as em and ex), the font size is relative to the parent element's font size.
For font-relative units that are root-based (such as rem), the font size is relative to the size of the font used by the (root) element.
A positive value, relative to the parent element's font size.
Browser support
font-size | 1 | 12 | 1 | 5.5 | 7 | 1 |
rem_values | 31 | 12 | 31 | 11 | 28 | 7 |
xxx-large | 79 | 79 | 70 |