In brief
The width of the content and the external size of the element do not always match. box-sizing determines how the width and height are involved in the calculation.
Useful to know
A rectangular element in CSS has more than visible content. The box model considers content, internal spacing, frame and external spacing. These parts perform different tasks. Padding separates the contents from the frame, and margin participates in the distance relative to other elements. Understanding them helps explain why two blocks of the same text can occupy a different place, even though their set width looks the same. [1]
The box-sizing property determines how the total width and height are calculated. In content-box, the set width refers to the content area, and the internal spacings and frame are added to it. In border-box, they are included in the specified size. [2] This is a specific calculation rule that can be shown with a small numerical example. It does not mean that the external spacings disappear or that each item will automatically fit into an arbitrary container.
Let's have a fictional map of a book with a width of two hundred units, an internal spacing of ten on each side, and a frame of one. At the standard content-box, the total width with the frame becomes two hundred and twenty-two. In border-box, the same parts are included in the set two hundred. The example shows why two columns can unexpectedly go out of order. Before reducing the font size arbitrarily, it is useful to check what actually measures the specified width.
External spacings also have features such as the merging of certain vertical margins into the normal layout. [1] This is a separate theme from the inclusion of the frame in the width. When diagnosing, it is useful to consider one problem at a time: first the size of the box, then the distance to the neighbors. If the two are changed at the same time without a clear purpose, accidental improvement can hide the cause and make the next edit of the page difficult.
For practical exercise we can use two identical cards and change only box-sizing. Then we add a longer title and observe the height. This shows the difference between horizontal calculation and natural placement of the text. We also check whether images or buttons create their own limitations. It is important that each observation be described against the specific values, and not as a general impression that CSS behaves unpredictably.
When the pattern is clear, the conversation about the layout becomes more accurate. We can ask for more internal space around the text, greater spacing between the cards, or a different overall width without these tasks being mixed. Box model provides the language for this distinction. Good support uses this language consistently and checks the end result with real content, including long titles and different window sizes, not just with a handy short example. External spacing in the numerical example is considered separately from the frame and interior space.
Sources
For further detail and to check the information: