contain

A containment property for performance optimization. ctnpapplies paint containment, ctnstapplies strict containment.

Class List

ClassCSSDescription
ctnncontain: noneNo containment (default)
ctnccontain: contentlayout + paint containment
ctnscontain: sizeSize containment (children do not affect parent size)
ctnlcontain: layoutLayout containment
ctnpcontain: paintPaint containment (children are not drawn outside boundaries)
ctnstcontain: strictsize + layout + paint strict containment

Usage Examples

<!-- Independent card widget -->
<div class="ctnc p2rem bg18181B br8px">
  <h3>Widget title</h3>
  <p>Changes to this card do not affect the outside.</p>
</div>

<!-- Long list item requiring performance optimization -->
<div class="ctnst h10rem oh">
  <p>Fully isolated element</p>
</div>

When to Use What?

SituationRecommended
독립적인 위젯/카드ctnc
오프스크린 요소 최적화ctnst
overflow: hidden 대체ctnp
레이아웃 재계산 방지ctnl