代码示例:(标识:jsck_prop_element_offsetparent)
<!DOCTYPE html>
<html>
<body>

<h1>Element 对象</h1>

<h2>offsetParent 属性</h2>

<div id="myDIV">
  <p>我的 offsetParent 是:</p>
  <p id="demo"></p>
</div>

<script>
const element = document.getElementById("myDIV");
document.getElementById("demo").innerHTML = element.offsetParent;
</script>

</body>
</html>
运行结果: