On this page
box-sizing
Prev: box_model | Up: box_model | Next: `margin`
Rel: box_model, Box Model & Sizing Guide
Ref: MDN Web Docs — box-sizing
Tags: #public #web #css #properties #box_model #tier/core
Syntax & Overview
box-sizing: border-box;
Determines whether width/height include padding and borders.
- Initial:
content-box| Inherited: No | Animatable: No
Notes & Best Practices
- Apply
border-boxglobally in every stylesheet: Makeswidth/heightincludepaddingandbordersowidth: 100%; padding: 1rem;never overflows its parent.
Example
*, *::before, *::after {
box-sizing: border-box;
}
Linked from
Related notes
- tuts/css/properties/box_model/margin Linked here; links to this page; shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model Linked here; links to this page; shared tags: #css, #properties, #web
- tuts/css/properties/box_model_and_sizing Linked here; shared tags: #css, #properties, #web
- tuts/css/properties/box_model/aspect-ratio shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/inline-size shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/overflow shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/padding shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/align-items shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/display shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/flex shared tags: #css, #properties, #tier, #web