Border-box sizing includes padding and borders in a declared width. This is useful when several cards must share a precise grid.
Worked example
<style>
.demo {
box-sizing: border-box;
width: 12rem;
padding: 1rem;
border: 4px solid teal;
}
</style>
<div class="demo">Border-box sizing</div>Implementation notes
The declared width still excludes margin. Two border-box columns that add up to a full row can overflow once external margins or gaps are included.
Try it yourself
Add a thicker border and measure the outside edge.
Open the CSS example →Editorial date January 14, 2026 · Published December 6, 2026