From MDN documentation toElement.offsetParent
:
The HTMLElement.offsetParent
read-only property returns a reference to the object that is the closest (closest in the hold hierarchy) positioned element. If the item is not located, the nearest table, table cell, or root element is returned offsetParent
Why .offsetParent
does it return the nearest table if the element is not located (i.e. position: static
)? Why doesn't it .offsetParent
always return the closest positional element?
I know that the answer to my question is because standard says so
, but why did the developers of the standard decide what was the purpose for this solution?
source
share