2_移动端常用的单位.html 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. *{
  10. margin: 0;
  11. padding: 0;
  12. }
  13. /* html{
  14. font-size: 50px;
  15. } */
  16. #div1{
  17. height: 200px;
  18. background: red;
  19. width: 3rem;
  20. font-size: 100px;
  21. }
  22. #div2{
  23. /* height: 100px; */
  24. background: orange;
  25. /* width: 2em; */
  26. /* width: 10vw;
  27. height: 10vh; */
  28. width: 10%;
  29. height: 10%;
  30. /* vw vh 把视口分为100等分 根据输入的数字 去取多少 */
  31. }
  32. /* rem 是根据html的字体大小 */
  33. /* em 是根据父元素的字体大小 */
  34. #div3{
  35. width: 100%;
  36. height: calc(100vh - 100px);
  37. background: blue;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <!-- <div id="div1">
  43. <div id="div2"></div>
  44. </div> -->
  45. <div id="div3"></div>
  46. </body>
  47. </html>