8_CSS3flex.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: 800px;
  10. height: 400px;
  11. border:2px dashed black;
  12. display: flex;
  13. /* justify-content: center; */
  14. /* align-items: center; */
  15. /* flex-direction: column;
  16. justify-content: space-around; */
  17. /* flex-wrap: wrap; */
  18. align-content: space-between;
  19. }
  20. .box2{
  21. flex-grow: 1;
  22. }
  23. .box3{
  24. /* order: -1; */
  25. /* align-self: flex-end; */
  26. /* flex-shrink: 2; */
  27. flex-grow: 2;
  28. }
  29. .box div{
  30. width: 100px;
  31. height: 100px;
  32. font-size: 40px;
  33. font-weight: bolder;
  34. text-align: center;
  35. line-height: 100px;
  36. background-color: red;
  37. }
  38. .box div:nth-child(odd){
  39. background-color: blue;
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <div class="box">
  45. <div class="box1">1</div>
  46. <div class="box2">2</div>
  47. <div class="box3">3</div>
  48. <!-- <div class="box4">4</div>
  49. <div class="box5">5</div>
  50. <div class="box6">6</div>
  51. <div class="box7">7</div>
  52. <div class="box8">8</div>
  53. <div class="box9">9</div>
  54. <div class="box10">10</div> -->
  55. </div>
  56. </body>
  57. </html>