Fluid Fonts
Fluid font sizes and line heights for every Tailwind text-* class, from your smallest to your largest viewport.
How fluid sizes work
With breakpoints a font size jumps: text-base stays 16px up to 767px, then becomes 18px. Between two breakpoints the text is either too big for a small phone or too small for a wide screen, and every jump needs another class like md:text-lg.
A fluid size grows linearly with the viewport between Min Width and Max Width and stays fixed outside them. CSS clamp() does it in one line: a minimum, a value that follows the viewport width (vi) and a maximum.
--text-base: clamp(1rem, 0.8957rem + 0.5217vi, 1.3rem);
text-base grows from 16px at 320px to 20.8px at 1240px
- No media queries: one class per element instead of text-base md:text-lg lg:text-xl.
- Proportions stay the same at every width, not only at the breakpoints.
- Values are in rem, so they still follow the font size the user set in the browser.