17_其他单位.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. .box1{
  9. width: 400px;
  10. height: 400px;
  11. border:1px solid black
  12. }
  13. .box2{
  14. width: 100%;
  15. height: 200px;
  16. background-color: red;
  17. /* padding:20px; */
  18. }
  19. body{
  20. margin: 0;
  21. }
  22. .box3{
  23. /* width: 100%; */
  24. background-color: red;
  25. /* vh\vw 会把整个视口分为100份 */
  26. /*width: 100vw; /* 视口宽度 viewport width*/
  27. height: 100vh; /* 视口高度 viewport height*/
  28. margin-left: 100px;
  29. /* width: calc(100vw - 100px); */
  30. width: calc(100% - 100px);
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <!-- <div class="box1">
  36. <div class="box2">hello</div>
  37. </div> -->
  38. <div class="box3"></div>
  39. </body>
  40. </html>