<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>前端开发单位vw</title>

  <style>
    *{
      padding: 0;
      margin: 0;

    }
    .root {
      width: 1vw;
      height: 1vh;
      background: red;
    }

  </style>
</head>
<body>
<div class="root"></div>

<script>
  console.log(window.innerWidth,window.innerHeight)
  let oDiv =document.querySelector(".root");

  console.log(getComputedStyle(oDiv).width)
  console.log(getComputedStyle(oDiv).height)

</script>
</body>
</html>

vw和vh介绍

前端开发单位vw和vh

什么是视口:

前端开发单位vw和vh

前端开发单位vw和vh

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2021-09-04
  • 2022-12-23
  • 2021-11-20
  • 2021-11-27
  • 2021-10-01
  • 2021-07-08
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-07-14
  • 2021-07-10
  • 2022-12-23
相关资源
相似解决方案