On this page
contain
Prev: `isolation` | Up: positioning | Next: typography
Rel: positioning, Positioning & Stacking Guide
Ref: MDN Web Docs — contain
Tags: #public #web #css #properties #positioning #tier/specialized
Syntax & Overview
contain: layout style paint | content | strict;
Tells the browser an element's subtree is independent of the rest of the page for faster layout/paint.
- Initial:
none| Inherited: No | Animatable: No
Notes & Best Practices
- Isolates layout/paint/style subtrees for rendering performance;
content-visibility: autopairs withcontain-intrinsic-sizeto skip offscreen rendering.
Example
.feed-item {
contain: layout style paint;
}
Linked from
Related notes
- tuts/css/properties/positioning/isolation Linked here; links to this page; shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning Linked here; links to this page; shared tags: #css, #positioning, #properties, #web
- tuts/css/properties/positioning_and_stacking Linked here; shared tags: #css, #positioning, #properties, #web
- tuts/css/properties/typography Linked here; shared tags: #css, #properties, #web
- tuts/css/properties/positioning/inset shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning/position shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning/z-index shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/box_model/aspect-ratio shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/box-sizing shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/inline-size shared tags: #css, #properties, #tier, #web