css - What is a positioned ancestor? -
i reading "positioning techniques" of article on mdn. talks "absolute positioning elements can fixed position relative nearest positioned ancestor element".
my understanding of "positioned ancestor" ancestor position property other static. need expert opinions verify thought.
when referring positioned ancestor mean closest ancestor element set position
value, other static
(which default).
so there 2 assumptions here:
- in case there more 1 positioned ancestors mean the closest.
- in case there ancestor set
position:static
(presumably set javascript, in order change "positioned ancestor") don't mean ancestor.
why important? because "positioned ancestor" reference properties left
, top
calculated, when descendant given position:absolute
. it's called "the reference element/parent" of descendant.
also, if closest ancestor has set z-index
(other auto
), creates stacking context descendants.
Comments
Post a Comment