Need help in understanding ScrollSpy in Bootstrap

Hello guys, I am new to coding. I would like to ask some question about ScrollSpy function
In both bootstrap 3 and 4, the official web stated that " scrollspy requires the use of position: relative; on the element you’re spying on (mostly /body)"
However, i found out that ScrollSpy works without position: relative
W3school ScrollSpy example
In the W3school example, the Scrollspy function works fine even if i deleted the body {position: relative}
W3school ScrollSpy example with deleted position:relative
Can someone help me and explain why it still works without position: relative

1 Like

@Zeta1 welcome to the FCC community!
This might be the reason why it works:

The body element by default position is static, and its child elements follow the body by default- that means children are positioned relative automatically.

According to bootstrap, it works when there presents a .nav class, and I checked deleting nav class - it does not work, but when I restore nav class it works. Finally it can be said it is working as how they designed nav class.

Thanks you for your reply. It is nice to meet you.
However, all the elements are positioned static by default, so doesn’t it mean that child elements in side body are static too?

Besides, If the child elements follow the body ,
doesn’t it means that the position should also be static as the body element is also static?