Typography and Colour for Tailwind CSSs
Typography and colour in Tailwind CSS are controlled with utilities for font family, size, weight, line height, letter spacing, text colour and background colour. The default palette offers numbered shades like blue-500, and opacity modifiers adjust transparency. These utilities help create readable text with consistent contrast across a whole interface.
Stage: Styling · Part of the Tailwind CSS roadmap · Last reviewed 19 November 2026
What to learn in Typography and Colour
- Set font size, weight and line height with text and font utilities
- Choose text and background shades that meet contrast guidelines
- Truncate or clamp long text using truncate and line-clamp
- Apply colour opacity with the slash syntax, such as bg-black/50
- Add the typography plugin to style rendered Markdown content
Typography and Colour interview questions
How do you apply opacity to a colour in Tailwind?
Use the slash modifier after the colour, such as bg-blue-600/50 for fifty percent opacity or text-white/80. This applies alpha only to that colour, unlike the opacity utility, which makes the whole element and its children transparent.
How do you make text readable on a coloured background?
Pick text and background shades with enough contrast, aiming for the WCAG ratio of 4.5 to 1 for body text. Pair dark shades like gray-900 with light backgrounds, check with a contrast tool, and do not rely on colour alone to convey meaning.
Where Typography and Colour fits in the Tailwind CSS roadmap
Typography and Colour belongs to the Styling stage (beginner level). Look and feel.
Other units in this stage
Back to the full Tailwind CSS roadmap