10.上中下布局.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #box {
  9. width: 100%;
  10. /* height: 800px; */
  11. display: flex;
  12. flex-direction: column;
  13. }
  14. #header {
  15. width: 100%;
  16. /* flex: 1; */
  17. height: 100px;
  18. background: #00f;
  19. }
  20. #main {
  21. width: 100%;
  22. flex: 8;
  23. background-color: #ff0;
  24. }
  25. /* #main .item {
  26. width: 200px;
  27. height: 200px;
  28. border: 1px solid #000;
  29. } */
  30. #footer {
  31. width: 100%;
  32. flex: 1;
  33. background: #f00;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div id="box">
  39. <div id="header">1</div>
  40. <div id="main">
  41. <div class="item">内容</div>
  42. <div class="item">内容</div>
  43. <div class="item">内容</div>
  44. <div class="item">内容</div>
  45. </div>
  46. <div id="footer">3</div>
  47. </div>
  48. </body>
  49. </html>