What does box-sizing: border-box do?

CSS

12/20/2022, 11:27:28 AM

by Leo Voon

`content-box` is the default

which mean that the padding and borders aren’t included in an element’s width/height

Box-sizing set to border-box will include them.

For example, setting width: 100px, width is still 100px after you set its padding / border to 20px.