Skip to main content
๐ŸŽจ CSS Basics

Padding & margin ๐Ÿ“ฆ

Every box has two kinds of space:

  • padding โ€” the cushion inside the box, between the text and the edge.
  • margin โ€” the gap outside the box, pushing other things away.
.box {
  padding: 16px;  /* space inside */
  margin: 8px;    /* space outside */
}

This rule has two lines instead of one โ€” but each line is the same property: value; shape you already know.

Your task

Give .box 20px of padding and 10px of margin. Drag the blocks in order, or type both lines.

โšก 30 XP

Hints

index.htmliframe
Loading editorโ€ฆ
Preview
Run your code to see test results.