<!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>