Tailwind CSS employs a standardized, highly intuitive mathematical scale for managing spacing, margins, paddings, and dimensions. Rather than guessing pixel values, developers compose with a 4-pixel base unit grid ($1 \text{ unit} = 0.25\text{rem} = 4\text{px}$).
Every numerical step in Tailwind's spacing scale corresponds to a multiple of 4px:
| Class | CSS Value (rem) | Equivalent Pixels | Use Case |
|---|---|---|---|
p-1 / m-1 | 0.25rem | 4px | Tight micro-spacing, badges |
p-2 / m-2 | 0.5rem | 8px | Small button paddings |
p-4 / m-4 | 1rem | 16px | Standard default container padding |
p-6 / m-6 | 1.5rem | 24px | Card component padding |
p-8 / m-8 | 2rem | 32px | Section margins |
p-12 / m-12 | 3rem | 48px | Hero section spacing |
p-16 / m-16 | 4rem | 64px | Page breaks & layout dividers |
Tailwind provides directional modifiers for precise spatial control:
When an exact pixel specification is required by an enterprise design system:
p-6?w-3/4?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.