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.

31 lines
853 B

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. /* 当父元素一行中有剩余空间怎么解决? */
  9. #div0 {
  10. width: 380px;
  11. background-color: blue;
  12. display: flex;
  13. flex-flow: row wrap;
  14. /* justify-content 用来在存于剩余空间时,设置为间距的方式 */
  15. justify-content: space-between;
  16. }
  17. #div0 div {
  18. width: 100px;
  19. height: 100px;
  20. background-color: aqua;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div id="div0">
  26. <div>1</div>
  27. <div>2</div>
  28. <div>3</div>
  29. <div>4</div>
  30. </div>
  31. </body>
  32. </html>