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.

72 lines
1.4 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. flex-wrap: wrap;
  27. }
  28. #main div:first-child {
  29. flex: 0 0 100%;
  30. background-color: #F0F8FF;
  31. list-style-type: none;
  32. display: flex;
  33. /* 设置允许换行 */
  34. flex-wrap: wrap;
  35. border-left: 1px solid white;
  36. border-right: 1px solid white;
  37. align-content: flex-start;
  38. }
  39. #main div:first-child li {
  40. flex: 0 0 30%;
  41. height: 40px;
  42. /* 设置文字水平居中 */
  43. line-height: 40px;
  44. text-align: center;
  45. border-bottom: 1px solid white;
  46. }
  47. #main div:nth-child(2) {
  48. flex: 0 0 100%;
  49. background-color: #F0F8FF;
  50. list-style-type: none;
  51. display: flex;
  52. /* 设置允许换行 */
  53. flex-wrap: wrap;
  54. /* 设置间隔 */
  55. justify-content: space-around;
  56. }
  57. #main div:nth-child(2) li {
  58. flex: 0 0 30%;
  59. height: 120px;
  60. text-align: center;
  61. border-bottom: 1px solid white;
  62. background-color: greenyellow;
  63. margin-top: 10px;
  64. }