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

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>

posted on 2021-09-10 09:57  aisowe  阅读(9)  评论(0编辑  收藏  举报

导航