Lesson 13 of 3043%
(Progress persistence is disabled until Phase 9)
Tailwind CSS
Beginner
Padding
Adding space inside elements.
Padding controls the space inside an element, between the content and the border.
The prefix is p, and it uses the exact same directional scale as margin:
p-4: Padding on all sidespx-6: Padding left and rightpy-2: Padding top and bottompt-8: Padding top
<button class="bg-blue-500 text-white px-4 py-2">
Button with padding
</button>
CSS Relationship
p-4 corresponds conceptually to CSS padding: 1rem;.