Font Size & CSS Units
The font-size property accepts many unit types. Choosing the right unit is important for accessibility and responsive design.
Absolute Units
px (pixels) are fixed and independent of the user's browser font preference. Avoid using px for body text — it breaks accessibility because it ignores the user's default font-size setting.
Relative Units
em— relative to the current element's font-size (or parent's, for non-font properties). Compounds through nesting.rem— relative to the root element (<html>) font-size. Predictable and accessible.%— relative to the parent's font-size.
Viewport Units
vw, vh, vmin, vmax are relative to the viewport and useful for fluid typography combined with clamp().