← Back to properties

CSS Property

font-size

Typography

Sets the size of the font for an element.

Syntax

font-size: value;

Example

font-size: 1rem;

Common use cases

  • Setting base text size
  • Responsive typography with clamp()
  • Scaling headings relative to body text

Practical developer insight

Prefer rem over px for font-size — it respects the user's browser font size preference and scales better for accessibility.

Related properties