html - Why doesn't an absolutely positioned element position itself relative to its parent if the parent is static? -


i've heard absolutely positioned element positions relative first non-statically-positioned ancestor. there more holistic reason this? or arbitrary choice made, wouldn't true static elements.

i guess i'm wondering if there's unified theory of css, speak, i.e. 1 that's perhaps complicated, less complex. 1 outlines behavior of position , static , absolute in such way interaction comes out of natural consequence.

i can't find explicit reference rule in css spec; might help.

simply because forcing people position elements relative parent element needless limitation. if want position element relative <body>? if want position element relative specific ancestor? well, set position: relative on target parent. without this, i'd need use js.

of course, don't think best way implemented. if wrote spec self, i'd make it:

position: absolute(selector); 

but of course, don't write spec.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -