Nearby lessons
40 of 61š Tailwind CSS - Sizing (Width, Height & Size)
š Overview
Tailwind provides comprehensive sizing utilities for controlling the width and height of elements,
including min/max constraints and the shorthand size utility.
š Width Utilities
Control element width with w-{value}:
- Fixed:
w-4(1rem),w-8,w-16,w-32,w-64 - Percentage:
w-1/2,w-1/3,w-2/3,w-3/4 - Viewport:
w-screen(100vw) - Special:
w-full(100%),w-auto,w-fit,w-min,w-max - Arbitrary:
w-[300px]
š Min-Width & Max-Width
Min-Width (min-w-{value}):
min-w-0,min-w-full,min-w-min,min-w-max,min-w-fit- Fixed:
min-w-4,min-w-8, etc.
Max-Width (max-w-{value}):
- Breakpoints:
max-w-sm,max-w-md,max-w-lg,max-w-xl,max-w-2xlā¦max-w-7xl max-w-full,max-w-screen-xl,max-w-none- Arbitrary:
max-w-[600px]
š Height, Min-Height & Max-Height
Height (h-{value}):
- Fixed:
h-4,h-8,h-16,h-32,h-64 - Percentage:
h-1/2,h-full - Viewport:
h-screen,h-svh,h-dvh - Special:
h-auto,h-fit,h-min,h-max
Min-Height: min-h-0, min-h-full, min-h-screen, min-h-fit
Max-Height: max-h-full, max-h-screen, max-h-{size}
š Size (Width & Height Shorthand)
The size-{value} utility sets both width and height simultaneously.
Available in Tailwind CSS v3.4+.
size-4ā 1rem Ć 1remsize-8ā 2rem Ć 2remsize-fullā 100% Ć 100%- Arbitrary:
size-[50px]
š§ Test Your Knowledge
4 QuestionsProgress: 0 / 4
Keep Going!Tailwind CSS - Font