property

CSS font-size

Sets the nominal font size, rather than a guarantee of visible glyph height. Percentages and em in this property resolve using the parent font size. Prefer scalable sizing for text and test zoom and user font settings.

Formal Syntax & Structure

css syntaxcss
font-size = <absolute-size> | <relative-size> | <length-percentage [0,∞]> | math

Parameters & Attributes

NameTypeDescription
sizekeyword or nonnegative length-percentageSize keyword or a length/percentage; math is a specialized keyword.

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>CSS reference demo</title><style>#sample { font-size: 20px; } #child { font-size: 125%; }</style></head><body><p id="sample">Field <span id="child">note</span></p></body></html>
CSS Reference