# The CSS Box Model: Padding, Border, Margin, and box-sizing

**URL:** <https://forum.kirupa.com/t/the-css-box-model-padding-border-margin-and-box-sizing/684291>\
**Category:** web dev\
**Created:** [December 1, 2026, 1:46am UTC](https://forum.kirupa.com/t/the-css-box-model-padding-border-margin-and-box-sizing/684291 "2026-12-01T01:46:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 1, 2026, 1:46am UTC](https://forum.kirupa.com/t/the-css-box-model-padding-border-margin-and-box-sizing/684291/1 "2026-12-01T01:46:21Z")

</div>

Set a div to 200 pixels wide, add some padding and a border, and it ends up 250 pixels wide. Our new tutorial takes one box apart layer by layer and shows the one-line fix, plus why margins sometimes collapse:

> **[The CSS Box Model: Padding, Border, Margin, and box-sizing](https://www.kirupa.com/html5/css_box_model.htm)**
>
> Every element on a page is a box made of content, padding, border, and margin. Learn how they add up, why box-sizing helps, and when margins collapse.

---

<div class="post-metadata">

**Author:** ![fizanahmed](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@fizanahmed](https://forum.kirupa.com/u/fizanahmed)\
**Post date:** [December 1, 2026, 7:09am UTC](https://forum.kirupa.com/t/the-css-box-model-padding-border-margin-and-box-sizing/684291/2 "2026-12-01T07:09:11Z")

</div>

This is a really clear explanation — the 200px example makes the difference obvious. I always set box-sizing: border-box globally now, because it makes widths predictable and saves a lot of debugging when padding is added later. Margin collapse still catches me out sometimes, especially with headings, so a reminder about that is useful.
