HTML DOM Element offsetParent property
- الصفحة السابقة offsetLeft
- الصفحة التالية offsetTop
- العودة إلى الطبقة السابقة مفهوم Elements DOM HTML
Definition and usage
offsetParent
the property returns the position of the nearest ancestor that is not static.
If the element is not visible (display="none"), then offsetParent
property returns null
。
see also:CSS box model tutorial
offsetParent
All block-level elements report the offset relative to the offset parent:
- offsetTop
- offsetLeft
- offsetWidth
- offsetHeight
The offset parent refers to the nearest ancestor with a non-static position.
If the offset parent does not exist, the offset is relative to the main text of the document.
see also:
example
Get the offsetParent of "myDIV":
let node = document.getElementById("myDIV").offsetParent;
syntax
return value
type | description |
---|---|
node | the nearest ancestor of the most recent positioning. |
browser support
all browsers support element.offsetParent
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
الدعم | الدعم | الدعم | الدعم | الدعم | الدعم |
- الصفحة السابقة offsetLeft
- الصفحة التالية offsetTop
- العودة إلى الطبقة السابقة مفهوم Elements DOM HTML