Box Sizing
Two utility classes for switching an element's box-sizing model between the default border-box and the legacy content-box behavior.
Usage
Every element in ArchCSS's reset already uses border-box globally. These classes exist for the rare case where you need to opt an individual element back into content-box, or make the choice explicit.
Preview - both boxes are 160px wide with 2rem padding
border-box
padding included in width
padding included in width
content-box
padding added to width
padding added to width
<div class="border-box" style="width:160px; padding:2rem;">
160px total, padding included
</div>
<div class="content-box" style="width:160px; padding:2rem;">
160px content + 2rem padding added on top
</div>
| Class | CSS |
|---|---|
.border-box | box-sizing: border-box |
.content-box | box-sizing: content-box |
ArchCSS concept: the global reset already setsborder-boxon every element, so.border-boxis mostly useful for overriding a.content-boxancestor or for clarity in markup.