Blogger Information
Blog 14
fans 0
comment 3
visits 17548
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
使用vh与vw实现手机端三行单列布局
余生
Original
1068 people have browsed it

vh与vw的基本概念

1.vh是相对于浏览器视口的高度定位大小 视口大小为100,1vh=1/100;
2.vw是相对于浏览器视口的宽度定位大小 视口大小为100,1vw=1/100;

实例演示通过vh与vw实现浏览器自适应三行单列布局

  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. </head>
  8. <style>
  9. .box1{
  10. width:100vw;
  11. height:30vh;
  12. background:cadetblue;
  13. margin-bottom:0.9em;
  14. }
  15. .box2{
  16. width:100vw;
  17. height:30vh;
  18. background:red;
  19. margin-bottom:0.8em;
  20. }
  21. .box3{
  22. width:100vw;
  23. height:30vh;
  24. background:fuchsia;
  25. }
  26. </style>
  27. <body>
  28. <div class="box1"></div>
  29. <div class="box2"></div>
  30. <div class="box3"></div>
  31. </body>
  32. </html>

实例演示通过vh与vw实现浏览器自适应三行单列布局

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post