Positioning something as absolute will position it relative to the nearest relatively positioned parent element.
If there is no relatively positioned parent, the absolute element will be positioned relative to the body
Before toggling, the teal box is outside of the black container in the DOM. It is being positioned relative to the body
After toggling, the teal box is appended to the black container as a child element.
Since the black container is positioned relatively, the teal box is then positioned relative to the black container.