12.左侧定宽右侧上中下.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. * {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. #box {
  13. display: flex;
  14. height: 800px;
  15. }
  16. #sideBar {
  17. width: 300px;
  18. height: 100%;
  19. background: #ff0;
  20. }
  21. #content {
  22. flex: 1;
  23. height: 100%;
  24. background: #f00;
  25. display: flex;
  26. flex-direction: column;
  27. }
  28. #content #header {
  29. height: 100px;
  30. width: 100%;
  31. background: #0f0;
  32. }
  33. #content #main {
  34. flex: 5;
  35. width: 100%;
  36. background: #f0f;
  37. }
  38. #content #footer {
  39. flex: 2;
  40. width: 100%;
  41. background: rgb(227, 151, 20);
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div id="box">
  47. <div id="sideBar">sideBar</div>
  48. <div id="content">
  49. <div id="header">header</div>
  50. <div id="main">main</div>
  51. <div id="footer">footer</div>
  52. </div>
  53. </div>
  54. </body>
  55. </html>