Box model playground

Knowledge Videos

Short animated explainers, organised by subject.

Box model playground

Slide padding, border and margin and watch a box and its total width change.

Every element is a box with four layers, from the inside out: content, padding, border and margin. Padding is space inside the border, and margin is space outside it.

Each layer adds its size on both sides of the content, so the box takes up the content width plus twice the padding, the border and the margin.

Things to try

From the videos