Browse documentation
Reference / Layout
Box sizing
Choose whether the declared width and height include the element’s border and padding.
Working example
Border box
Content box
Both samples declare the same width. The content-box sample adds its padding and border outside that measurement.
<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
| Class | CSS declarations |
|---|---|
box-border | box-sizing: border-box; |
box-content | box-sizing: content-box; |
View full generated CSS
.box-border {
box-sizing: border-box;
}
.box-content {
box-sizing: content-box;
}