Returns an array of numeric margins in pixels from the given margin string.
The string should contain margins in either pixels or percentage; other
units are not supported.
Percentage values are converted to pixels relative to the given
absoluteSize: left/right margins relative to the width, and top/bottom
margins relative to the height.
Note that for the margin property, percentages are always relative to the
WIDTH of the parent, so you should pass the parent width as both the width
and the height keys in absoluteSize. But for IntersectionObserver's
rootMargin, top/bottom margin is relative to the height of the root, so
pass the actual root size.
Returns an array of numeric margins in pixels from the given margin string. The string should contain margins in either pixels or percentage; other units are not supported.
Percentage values are converted to pixels relative to the given
absoluteSize
: left/right margins relative to the width, and top/bottom margins relative to the height.Note that for the margin property, percentages are always relative to the WIDTH of the parent, so you should pass the parent width as both the width and the height keys in
absoluteSize
. But for IntersectionObserver'srootMargin
, top/bottom margin is relative to the height of the root, so pass the actual root size.