concept
Size containment — CSS reference
Size containment calculates the element’s dimensions as if its contents were absent, except for explicit intrinsic-size overrides. Its descendants still exist and can overflow. An auto-height box without border, padding or a placeholder can collapse.
Formal Syntax & Structure
css syntaxcss
contain: size;Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>size-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:150px;contain:size}</style><body><section id="box"><div id="child" style="width:100px;height:60px">Content</div></section></body></html>