Problem with Absolute Positioning

Problem with Absolute Positioning
0

#1

One of the challenges of freecodecamp says:

" One nuance with absolute positioning is that it will be locked relative to its closest positioned ancestor. If you forget to add a position rule to the parent item, (this is typically done using position: relative; ), the browser will keep looking up the chain and ultimately default to the body tag."

But I used a absolute positioning on an element, and did not positioned any other element… What happened was that the element that was absolute positioned was positioned relative to its first parent… I imagined that it would be positioned relative to the body element…


#2

Hopefully, this helps:

CSS Layout - The position Property