CSS Box Sizing
The box-sizing property allows us to include the padding and border in an element's total width and height.
CSS Box Sizing
The box-sizing property allows us to include the padding and border in an element's total width and height.
Without box-sizing
By default, the width and height of an element is calculated like this:
width + padding + border = actual width of an element
height + padding + border = actual height of an element
With box-sizing: border-box
The box-sizing: border-box; property allows us to include the padding and border in an element's total width and height.
This div has width 300px, padding 20px, and border 10px. Total width remains 300px.