Utilities
Utilities do one thing each, with Tailwind's names and meanings. On the same element, a utility wins over a layout class or a component. {n} is a spacing step: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12 or 16, each 4px at standard density. s and e mean start and end, which follow the text direction; l and r are always left and right, so prefer s and e.
- Margin and padding
- Display and visibility
- Width
- Text
- Background, border, radius and shadow
- Overflow and lists
Margin and padding
Space outside (margin) and inside (padding) an element. Every property comes in every step.
| Class | What it does |
|---|---|
fz-{m, | All sides. |
fz-{m, | Left and right (x), or top and bottom (y). |
fz-{m, | Top, or bottom. |
fz-{m, | Start, or end. |
fz-{m, | Left, or right. |
fz-m{, | Automatic margins: centre a block (fz-mx-auto), or push it to one end of a row (fz-ms-auto). |
- The more specific one wins:
fz-m-4 fz-mt-0leaves the top margin at 0. - A margin utility on a child of a layout class wins over the layout class's margin reset.
Display and visibility
Show, hide, and change how an element is laid out.
| Class | What it does |
|---|---|
fz-{block, | Display type. |
fz-hidden | Hidden. |
fz-sr-only | Hidden on screen but read by screen readers: a label for something only an icon shows. |
fz-hide-on-mobile | Hidden on screens narrower than 48rem (768px). |
fz-show-on-mobile | Hidden on screens 48rem and wider. |
Width
Width, and whether an element can shrink.
| Class | What it does |
|---|---|
fz-w-{full, | The full width of its container, its natural width, or the width of its content. |
fz-max-w-full | Never wider than its container. |
fz-min-w-0 | On a child of a flex or grid container: may get narrower than its content. fz-truncate needs it there. |
Text
Size, weight, font, line height, alignment, colour and wrapping.
| Class | What it does |
|---|---|
fz-text-{xs, | Size, with its line height. |
fz-font-{normal, | Weight. |
fz-font-{sans, | The main font, the secondary font, or the monospaced font. |
fz-leading-{tight, | Line height. |
fz-text-{start, | Alignment. |
fz-text-{default, | The normal, secondary or tertiary text colour. |
fz-text-{accent, | Coloured text. For short, emphasised text such as a total or a status word, not paragraphs: some themes' status colours are too light for body text. |
fz-truncate | One line, cut off with an ellipsis. |
fz-text-nowrap | Never wraps. |
fz-wrap-break-word | Long words and URLs break rather than overflow. |
fz-tabular-nums | Figures of equal width, so columns of numbers line up. |
Example
<div class="fz-stack fz-gap-2">
<p class="fz-text-2xl fz-font-semibold fz-tabular-nums">$12,480.00</p>
<p class="fz-text-muted fz-text-sm">Raised so far this year</p>
<p><span class="fz-text-success fz-font-semibold">+18%</span> <span class="fz-text-muted">compared with last year</span></p>
</div>Background, border, radius and shadow
Surfaces and edges, from the tokens.
| Class | What it does |
|---|---|
fz-bg-{page, | Surface backgrounds. |
fz-bg-{accent, | The accent, or a pale tint of it. |
fz-bg-{success, | A pale status tint. |
fz-border | A 1px border on every side. |
fz-border-{t, | A 1px border on one side. |
fz-border-0 | No border. |
fz-border-{strong, | The border's colour, with a border class. |
fz-rounded-{none, | Corner radius. |
fz-shadow-{none, | Shadow. |
Example
<div class="fz-cluster fz-gap-4">
<div class="fz-p-4 fz-bg-surface fz-border fz-rounded-lg fz-shadow-sm">Surface</div>
<div class="fz-p-4 fz-bg-accent-soft fz-rounded-lg">Accent tint</div>
<div class="fz-p-4 fz-bg-warning-soft fz-border fz-border-warning fz-rounded-lg">Warning</div>
</div>Overflow and lists
What happens to content that doesn't fit, and list markers.
| Class | What it does |
|---|---|
fz-overflow-{auto, | Scroll when needed, scroll sideways only, or clip. |
fz-list-none | No bullets or numbers. |