CSSEasy
What is the box model, and what does box-sizing: border-box change?
By FrontendPro Editorial Team Updated 8/7/2026
#css#layout#box-model
Answer
Every element is content → padding → border → margin.
content-box(default):widthcovers only the content, padding and border are added → a declared 200px renders 240px wide.border-box:widthincludes padding + border → layout math gets far simpler.
css
*, *::before, *::after { box-sizing: border-box; }
Margin sits outside the box and is never counted by width in either mode.
