Skip to content
Justice Tech School

Spacing: Margin and Padding

Classes follow the pattern property side size. m is margin, p is padding, t b s e x y choose a side and 0 to 5 set the size. Use mx-auto to center blocks.

Example
<div class="mt-3 mb-5 px-4 py-2">Spaced</div>
<div class="mx-auto" style="width:200px">Centered</div>

Exercise

Padding on all sides.

-3

Quiz Test

What does mt-3 set?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.