CSS lab

Box model

Change padding, border, margin and box-sizing and watch the rendered size of an element change.

InteractiveThe box model, live
Loading interactive…

Margin is outside the border and never part of the element's own size. With border-box, the content area shrinks to make room for padding and border.

Learn the concept

The lesson this lab comes from, with the explanation, a practice task and a quiz.

More labs

All labs