Tree of DesignAll terms A–Z

Box Model

CSS's model of content, padding, border and margin.

See it on the 3D tree

Going deeper

Every element is treated as a rectangle with layers from inside out. By default, a set width applies to the content only, so padding and border add to it; with box-sizing set to border-box, they are included. Vertical margins between block elements can also collapse into one.

Why it matters

It explains why elements are larger or further apart than expected and helps you specify spacing that can be built accurately.

In practice

Two stacked paragraphs each have a margin, yet the visible gap equals the larger margin rather than their sum.

Common mistake

Specifying a card's width without saying whether its padding and border are included.

Connected terms