There is two size in html/css inner size and outer size. With box-sizing, you can set border size inner or outer.
Border in outer width :
div {
box-sizing: content-box; /* default */
}
Border in inner width (width - border-width)
:
div {
box-sizing: border-box; /* default */
}
Source: W3 - Box Sizing
Example :
For example, the following properties set the inner size of the box to
100px, and the outer size to 120px:
.box {
box-sizing: content-box; /* default */
width: 100px;
padding-left: 10px;
border-left: 10px solid;
}
On the other hand, by changing to border-box, the inner size is now
80px, while the outer size is 100px:
.box {
box-sizing: border-box;
width: 100px;
padding-left: 10px;
border-left: 10px solid;
}
The inner size can’t be less than zero, so if the padding + border is
greater than the specified outer size, the box will end up larger than
specified. In this case, the inner size will be 0px while the outer
size is 120px, even though width: 100px is specified:
.box {
box-sizing: border-box;
width: 100px;
padding-left: 60px;
border-left: 60px solid;
/* padding + border = 120px */
}
Box dimension
8.1 Box dimensions
Each box has a content area (e.g., text, an image, etc.) and optional
surrounding padding, border, and margin areas; the size of each area
is specified by properties defined below. The following diagram shows
how these areas relate and the terminology used to refer to pieces of
margin, border, and padding:

The margin, border, and padding can be broken down into top, right,
bottom, and left segments (e.g., in the diagram, "LM" for left margin,
"RP" for right padding, "TB" for top border, etc.).
The perimeter of each of the four areas (content, padding, border, and
margin) is called an "edge", so each box has four edges:
content edge or inner edge
The content edge surrounds the rectangle given by the width and height of the box, which often depend
on the element's rendered content. The four content edges define the
box's content box.
padding edge
The padding edge surrounds the box padding. If the padding has 0 width, the padding edge is the same as the content
edge. The four padding edges define the box's padding box.
border edge
The border edge surrounds the box's border. If the border has 0 width, the border edge is the same as the padding
edge. The four border edges define the box's border box.
margin edge or outer edge
The margin edge surrounds the box margin. If the margin has 0 width, the margin edge is the same as the
border edge. The four margin edges define the box's margin box.
Each edge may be broken down into a top, right, bottom, and left edge.
The dimensions of the content area of a box — the content width and
content height — depend on several factors: whether the element
generating the box has the 'width' or 'height' property set, whether
the box contains text or other boxes, whether the box is a table, etc.
Box widths and heights are discussed in the chapter on visual
formatting model details.
The background style of the content, padding, and border areas of a
box is specified by the 'background' property of the generating
element. Margin backgrounds are always transparent.