Identifying the containing block
The process for identifying the containing block depends entirely on the value of the element's position
property:
-
If the
position
property isstatic
,relative
, orsticky
, the containing block is formed by the edge of the content box of the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself). -
If the
position
property isabsolute
, the containing block is formed by the edge of the padding box of the nearest ancestor element that has aposition
value other thanstatic
(fixed
,absolute
,relative
, orsticky
). -
If the
position
property isfixed
, the containing block is established by the viewport (in the case of continuous media) or the page area (in the case of paged media). -
If the
position
property isabsolute
orfixed
, the containing block may also be formed by the edge of the padding box of the nearest ancestor element that has any of the following:- A
filter
,backdrop-filter
,transform
, orperspective
value other thannone
. - A
contain
value oflayout
,paint
,strict
orcontent
(e.g.contain: paint;
). - A
container-type
value other thannormal
. - A
will-change
value containing a property for which a non-initial value would form a containing block (e.g.filter
ortransform
). - A
content-visibility
value ofauto
.
- A