Blogger Information
Blog 19
fans 0
comment 0
visits 10768
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
flex术语
牙森江
Original
424 people have browsed it

1.flex术语

1.1 flex容器

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. .demo {
  10. display: flex;
  11. width: 40rem;
  12. height:20rem ;
  13. background-color: rgb(209, 251, 143);
  14. }
  15. .demo > .item {
  16. width: 8rem;
  17. height: 15rem;
  18. background-color: rgb(153, 195, 230);
  19. border: 0.1rem solid black;
  20. margin-left: 0.1rem;
  21. text-align: center;
  22. line-height: 15rem;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div class="demo">
  28. <div class="item">01</div>
  29. <div class="item">02</div>
  30. <div class="item">03</div>
  31. <div class="item">04</div>
  32. </div>
  33. </body>
  34. </html>

代码运行效果如下:

" class="reference-link">

1.2flex容器子元素交叉轴和主轴排列方法

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. .demo {
  10. display: flex;
  11. width: 40rem;
  12. height:20rem ;
  13. background-color: rgb(209, 251, 143);
  14. place-content: space-between; /*两端对齐 (掌握)*/
  15. place-content: space-around; /*分散对齐(掌握)*/
  16. place-content: space-evenly; /*平均对齐 (掌握)*/
  17. /* 交叉轴 */
  18. /* place-items: stretch; */
  19. /* place-items: start; */
  20. place-items: center;
  21. /* place-items: end; */
  22. }
  23. .demo > .item {
  24. width: 8rem;
  25. height: 15rem;
  26. background-color: rgb(153, 195, 230);
  27. border: 0.1rem solid black;
  28. margin-left: 0.1rem;
  29. text-align: center;
  30. line-height: 15rem;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <div class="demo">
  36. <div class="item">01</div>
  37. <div class="item">02</div>
  38. <div class="item">03</div>
  39. <div class="item">04</div>
  40. </div>
  41. </body>
  42. </html>

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:总结的不错,继续加油
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post