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:

  1. in case there more 1 positioned ancestors mean the closest.
  2. 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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -