CSS box model

The rule that every element is drawn as a rectangle made of four layers: content, then padding, then border, then margin.

In more detail

Width and height apply to the content box by default, so padding and border add to the element's visible size. Margins sit outside the border and separate the element from its neighbours.

Related terms

Taught in

References