font-size
property
Sets the size of the font. Prefer rem units for accessibility-friendly scaling.
Syntax
font-size: value;
Example
css
html { font-size: 16px; } /* 1rem = 16px */
h1 { font-size: 2.5rem; } /* 40px */
h2 { font-size: 2rem; } /* 32px */
p { font-size: 1rem; } /* 16px */
.small { font-size: 0.875rem; } /* 14px */
/* Fluid typography */
.fluid {
font-size: clamp(1rem, 2.5vw, 2rem);
}