box-sizing

The CSS property that decides whether width and height measure only the content (content-box) or include padding and border (border-box).

In more detail

With content-box, a 200px box with 16px padding and a 2px border is 236px wide on screen. With border-box it stays 200px and the content shrinks, which is far easier to reason about, so most CSS resets apply border-box to everything.

Example

*, *::before, *::after { box-sizing: border-box; }

Related terms

Taught in

References