Summary
contain: layout style paint isolates subtree recalc — useful for list items, widgets, virtualized rows. content-visibility: auto skips rendering off-screen content (approximate size required). Wrong containment breaks position: fixed descendants or overflow-visible popovers. Measure before/after on large lists.
Code example
.list-item {
contain: layout style paint;
content-visibility: auto;
contain-intrinsic-size: 0 80px;
}
Key points
contain: layout style paintisolates subtree recalc — useful for list items, widgets, virtualized rows.content-visibility: autoskips rendering off-screen content (approximate size required).- Wrong containment breaks
position: fixeddescendants or overflow-visible popovers. - Measure before/after on large lists.