Why does my box appear larger than the width I set?
Because width only sets the content area. Padding and border add extra size outside the content, making the total box bigger. See render_steps 2 and 3.
💡 Total box size = width + padding + border (unless box-sizing is changed).
Why does margin not add to the box size but still creates space?
Margin is outside the border and does not affect the box's own size, but it pushes other elements away, creating space around the box. See render_steps 4.
💡 Margin separates elements, padding and border add inside the box.
Why does setting width to 100% sometimes cause overflow?
Because padding and border add extra size beyond the 100% content width, causing the box to be wider than its container. This is explained in render_steps 2 and 3.
💡 Use box-sizing: border-box to include padding and border inside width.