14.左侧固定 右侧上中下.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. width: 800px;
  14. height: 800px;
  15. background: #eee;
  16. display: flex;
  17. }
  18. #sideBar {
  19. width: 300px;
  20. height: 100%;
  21. background: #0f0;
  22. }
  23. #right {
  24. flex: 1;
  25. background: #00f;
  26. margin-left: 10px;
  27. display: flex;
  28. flex-direction: column;
  29. }
  30. #right #header {
  31. flex: 1;
  32. background: #f00;
  33. }
  34. #right #content {
  35. flex: 4;
  36. background: #ff0;
  37. }
  38. #right #footer {
  39. flex: 1;
  40. background: pink;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div id="box">
  46. <div id="sideBar"></div>
  47. <div id="right">
  48. <div id="header"></div>
  49. <div id="content"></div>
  50. <div id="footer"></div>
  51. </div>
  52. </div>
  53. </body>
  54. </html>