concept

Paint containment — CSS reference

Paint containment clips descendants to the overflow clip edge and establishes a stacking context and containing blocks. It can prevent visible overflow even when overflow is otherwise visible. Test hit testing outside the contained region as a local consequence of clipping.

Formal Syntax & Structure

css syntaxcss
contain: paint;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>paint-containment</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#box{width:50px;height:40px;contain:paint}</style><body><section id="box"><div id="child" style="width:100px;height:60px">Content</div></section></body></html>
CSS Reference