9.上中下加左侧固定.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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: 900px;
  11. display: flex;
  12. flex-direction: column;
  13. }
  14. #header {
  15. width: 100%;
  16. height: 100px;
  17. background: #00f;
  18. }
  19. #main {
  20. width: 100%;
  21. flex: 8;
  22. /* height: 100px; */
  23. background: #ff0;
  24. display: flex;
  25. }
  26. #sideBar {
  27. width: 200px;
  28. height: 100%;
  29. background: red;
  30. }
  31. #article {
  32. flex: 1;
  33. height: 100%;
  34. margin-left: 10px;
  35. background: purple;
  36. }
  37. #footer {
  38. width: 100%;
  39. flex: 1;
  40. background: #0ff;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div id="box">
  46. <div id="header">
  47. </div>
  48. <div id="main">
  49. <div id="sideBar"></div>
  50. <div id="article"></div>
  51. </div>
  52. <div id="footer">
  53. </div>
  54. </div>
  55. </body>
  56. </html>