concept
containing-block — CSS reference
A rectangle used to resolve positioning or sizing. Normal-flow boxes commonly use an ancestor content box; an absolute box commonly uses a positioned block ancestor’s padding box. A transform can establish a containing block too. The containing block need not be the direct DOM parent.
Formal Syntax & Structure
css syntaxcss
Containing block (layout concept).Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS positioning lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#p{width:240px;height:160px;background:#e6eef2} #a{width:60px;height:30px;background:#128579} #b{height:20px;background:#adcde8}#p{position:relative;padding:20px;border:5px solid black}#a{position:absolute;left:0;top:0;width:50%}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>