An absolute element's containing block is its nearest non-static
ancestor. position: relative
is a common way to define a containing block.
position: relative
No position specified
(default:
position: static
)position: absolute
position: relative
position: relative
(Defines containing block)
position: absolute
An in-flow (position
is static
, relative
, or sticky
) element's containing block is its nearest block-level ancestor (including inline-block
). The containing block defines relative units.
div
(block)
width: 100%
span
(inline)
width: 100%
span
display: inline-block
width: 100%
An in-flow (static
, relative
, or sticky
) element's containing block includes only the content box, excluding padding. An absolute
element's containing block contains the content and padding boxes.
This is the parent content.
Doggo ipsum big bork and boop da snoot
This is the parent content.
Doggo ipsum big bork and boop da snoot