获取指定元素的最终样式信息

时间:2021-09-11 15:28:20   收藏:0   阅读:10

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <h3>Hello, World!</h3>
    <script>
      const finalStyleObject = window.getComputedStyle(
        document.querySelector("h3")
      );
      console.log(finalStyleObject);
    </script>
  </body>
</html>

原文:https://www.cnblogs.com/aisowe/p/15250131.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!