Tsallaka zuwa abun ciki
Justice Tech School

Padding versus Margin

Padding is space inside the border and shows the background. Margin is space outside the border and is transparent. Use padding to make things roomy and margin to separate things.

Example
<style>
.p { background: #0f766e; padding: 20px; margin-bottom: 14px } .m { background: #0f766e; margin: 0 0 14px 40px }
</style>
<div class="p">padding inside</div><div class="m">margin outside</div>

Exercise

Space inside the border.

: 10px;

Quiz Test

Which shows the background colour?

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