You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.3 KiB

2 years ago
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. background-color: #F0F8FF;
  5. }
  6. #layout {
  7. display: flex;
  8. /* 主轴方向为纵向 */
  9. flex-direction: column;
  10. width: 80%;
  11. /* 居中 */
  12. margin: 0 auto;
  13. }
  14. #top {
  15. width: 100%; /* 这里的100%相当于父级 layout 的80%*/
  16. flex: 0 0 50px;
  17. margin: 0 auto;
  18. background-color: yellow;
  19. /* height: 50px; */
  20. }
  21. #main {
  22. flex: 0 0 100%;
  23. display: flex;
  24. flex-direction: row; /* 默认,可设可不设 */
  25. }
  26. #main div:first-child {
  27. flex: 0 0 10%;
  28. background-color: #F0F8FF;
  29. list-style-type: none;
  30. display: flex;
  31. /* 设置允许换行 */
  32. flex-wrap: wrap;
  33. border-left: 1px solid white;
  34. border-right: 1px solid white;
  35. }
  36. #main div:first-child li {
  37. flex: 0 0 100%;
  38. height: 40px;
  39. /* 设置文字水平居中 */
  40. line-height: 40px;
  41. text-align: center;
  42. border-bottom: 1px solid white;
  43. }
  44. #main div:nth-child(2) {
  45. flex: 0 0 90%;
  46. background-color: #F0F8FF;
  47. list-style-type: none;
  48. display: flex;
  49. /* 设置允许换行 */
  50. flex-wrap: wrap;
  51. /* 设置间隔 */
  52. justify-content: space-around;
  53. }
  54. #main div:nth-child(2) li {
  55. flex: 0 0 30%;
  56. height: 120px;
  57. text-align: center;
  58. border-bottom: 1px solid white;
  59. background-color: greenyellow;
  60. margin-top: 10px;
  61. }