When referring to positioned ancestor we mean the closest ancestor to the element with a set position
value, other than static
(which is default).
So there are two assumptions here:
- In case there are more than one positioned ancestors we mean the closest.
- In case there is an ancestor with a set
position:static
(presumably set by JavaScript, in order to change the "positioned ancestor") we don't mean that ancestor.
Why is this important? Because the "positioned ancestor" is the reference from which properties like left
and top
are calculated, when the descendant is given position:absolute
. It's also called "the reference element/parent" of the descendant.
Also, if this closest ancestor has a set z-index
(other than auto
), it creates a stacking context for its descendants.