Browse documentation

Reference / Layout

Box sizing

Choose whether the declared width and height include the element’s border and padding.

Working example

Both samples declare the same width. The content-box sample adds its padding and border outside that measurement.

HTML
<div class="space-y-2">
  <div class="box-border w-32 border-2 p-2">Border box</div>
  <div class="box-content w-32 border-2 p-2">Content box</div>
</div>

Class reference

ClassCSS declarations
box-borderbox-sizing: border-box;
box-contentbox-sizing: content-box;
View full generated CSS
Compiled CSS
.box-border {
  box-sizing: border-box;
}
.box-content {
  box-sizing: content-box;
}