Box Model
This card is set to 320px. Why does adding padding make it overflow its container?
This card is set to 320px. Why does adding padding make it overflow its container?
box-sizing: content-box;width: 320px;Content is not the whole width: The content box holds text and images; padding creates breathing room, border wraps them, and margin separates the element from its neighbors.
Layout uses the actual footprint: When elements sit side by side, the browser calculates the space they truly occupy. DevTools box-model inspection shows whether content, padding, border, or margin caused the squeeze.
Inspect the box model of these two-column cards and state the space used by content width, padding, border, and margin. Keep two columns on desktop and prevent horizontal overflow at 390px; afterward confirm the computed size in developer tools.
Build in 3D. Put your computer to work.