CSS Output Prediction Medium +20 XP
Position Absolute
What is this element positioned relative to?
CSSRead-only
.parent { position: relative; }
.child { position: absolute; top: 0; left: 0; }What is the output?
Show answer and explanation
Answer: The nearest positioned ancestor (.parent)
position: absolute positions relative to the nearest ancestor with position set (not static). Here that's .parent.
Hint: Absolute needs a positioned ancestor to anchor to.
What this challenge tests
Output Prediction in CSS: positioning, absolute.