Utilities
Sizing
Width and height — full, fractions, the spacing scale, and readable maximums.
Width
w-full
w-3/4
w-1/2
w-1/3
w-fit
<div class="space-y-2">
<div class="w-full">w-full</div>
<div class="w-3/4">w-3/4</div>
<div class="w-1/2">w-1/2</div>
<div class="w-1/3">w-1/3</div>
<div class="w-fit">w-fit</div>
</div>
<div class="flex flex-col sm:flex-row gap-3">
<input class="form-control w-full sm:w-1/2" placeholder="Full width on phones, half from sm">
<button class="btn btn-default btn-solid w-full sm:w-auto">Search</button>
</div>
A button that's full width on phones (easy to tap) and its own size from sm up.
Max width
Long text is easiest to read at about 65 characters a line. max-w-prose keeps paragraphs there however wide the screen gets, and mx-auto centers the column.
<p class="max-w-prose mx-auto my-0">Long text is easiest to read at about 65 characters a line. <code>max-w-prose</code> keeps paragraphs there however wide the screen gets, and <code>mx-auto</code> centers the column.</p>
Height
h-full
h-20
h-12
h-fit
<div class="flex items-end gap-2 h-32">
<div class="h-full">h-full</div>
<div class="h-20">h-20</div>
<div class="h-12">h-12</div>
<div class="h-fit">h-fit</div>
</div>
Square sizes
<div class="size-10">…</div> <!-- 40 × 40px -->
Widths from the scale
w-8 · 32px
w-16 · 64px
w-32 · 128px
w-48 · 192px
w-64 · 256px
<div class="space-y-2">
<div class="w-8">w-8 · 32px</div>
<div class="w-16">w-16 · 64px</div>
<div class="w-32">w-32 · 128px</div>
<div class="w-48">w-48 · 192px</div>
<div class="w-64">w-64 · 256px</div>
</div>
Maximum widths
max-w-xs
max-w-sm
max-w-md
max-w-lg
<div class="space-y-2">
<div class="max-w-xs">max-w-xs</div>
<div class="max-w-sm">max-w-sm</div>
<div class="max-w-md">max-w-md</div>
<div class="max-w-lg">max-w-lg</div>
</div>
Minimum height
min-h-screen makes a page at least as tall as the phone's visible screen, so a short page still has its footer at the bottom.
Header
Short content…
Footer stays at the bottom
<body class="flex flex-col min-h-screen">
<header>…</header>
<main class="flex-1">…</main>
<footer>…</footer>
</body>
| Class | Does |
|---|---|
w-full · w-auto · w-fit · w-min · w-max · w-screen | width |
w-1/2 · w-1/3 · w-2/3 · w-1/4 · w-3/4 · w-1/5 … w-4/5 | a share of the parent |
w-{n} · h-{n} · size-{n} | the spacing scale (w-12 = 48px); size = width and height |
h-full · h-auto · h-fit · h-screen | height (h-screen follows the phone's visible height) |
min-w-0 · min-w-full · min-h-0 · min-h-screen | minimums — min-w-0 lets flex children shrink |
max-w-xs (320px) … max-w-7xl (1280px) · max-w-prose · max-w-full · max-h-screen | maximums |
| All of them | work with breakpoints: w-full md:w-1/2 |