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.

36 lines
1.1 KiB

2 years ago
  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. #div0 {
  9. width: 380px;
  10. background-color: blue;
  11. display: flex;
  12. /* 主轴为 row ,横向排列;主轴为 column,纵向排列 */
  13. flex-flow: row wrap;
  14. justify-content: space-between;
  15. /* align-items 是设置每个 flex 元素在交叉轴上的默认方式,控制单行的效果 */
  16. /* align-items: center; */
  17. /* align-content 也是设置每个 flex 元素在交叉轴上的默认方式,但是是控制多行的效果 */
  18. align-content: center;
  19. height: 400px;
  20. }
  21. #div0 div {
  22. width: 100px;
  23. height: 100px;
  24. background-color: aqua;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div id="div0">
  30. <div>1</div>
  31. <div>2</div>
  32. <div>3</div>
  33. <div>4</div>
  34. </div>
  35. </body>
  36. </html>