Blogger Information
Blog 12
fans 0
comment 0
visits 6609
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
flex 容器和项目 常用属性
Giesen?
Original
472 people have browsed it
  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>flex容器和项目中常用的属性</title>
  8. <style>
  9. .rq{
  10. /* .rq转为flex容器 */
  11. background-color: aqua;
  12. display: flex;
  13. height: 500px;
  14. width: 500px;
  15. flex-flow: row wrap;
  16. /* --------------------------------- */
  17. /* 主轴方向 */
  18. /* flex-direction:row; 正向排列 默认 */
  19. /* flex-direction:row-reverse; 反向排列 */
  20. /* flex-direction:column; 主轴改为垂直方向 */
  21. /* flex-flow: row wrap; row/row-reverse 正向或者反向 wrap允许换行转为多行容器/nowrap */
  22. /* ------------------------------- */
  23. /* 项目主轴对齐方式 */
  24. /* 项目 主轴居中 */
  25. justify-content: center;
  26. /* 项目 主轴靠尾部 */
  27. /* justify-content: flex-end; */
  28. /* 项目 主轴靠起始点 */
  29. /* justify-content: flex-start; */
  30. /* --------------------------- */
  31. /* 分配项目的剩余空间 */
  32. /* justify-content: space-around; 分散对齐 */
  33. /* justify-content: space-between; 两端对齐 */
  34. /* justify-content: space-evenly; 平行对齐 */
  35. /* ------------------------------------- */
  36. /* 交叉轴对齐方式 */
  37. /* align-items:stretch; 拉伸对齐 */
  38. /* align-items:flex-start; 上端对齐 */
  39. /* align-items:flex-end; 下端对齐 */
  40. /* align-items:center; 居中对齐 */
  41. }
  42. /* flex项目属性 */
  43. .rq div {
  44. /* 项目 宽度设置 */
  45. flex-basis: 50px;
  46. /* flex: 放大因子 收缩因子 宽度自动 0为禁止 1为允许 auto自动 或者 固定值 */
  47. flex:1 1 auto;
  48. }
  49. .rq .a{
  50. /* 单独设置某个项目交叉轴的属性 */
  51. align-self:center;
  52. }
  53. </style>
  54. </head>
  55. <body>
  56. <div class="rq">
  57. <div class="a">
  58. <p>亲爱的祖国</p>
  59. </div>
  60. <div>
  61. <p>亲爱的祖国</p>
  62. </div>
  63. <div>
  64. <p>亲爱的祖国</p>
  65. </div>
  66. <div>
  67. <p>亲爱的祖国</p>
  68. </div>
  69. <div>
  70. <p>亲爱的祖国</p>
  71. </div>
  72. <div>
  73. <p>亲爱的祖国</p>
  74. </div>
  75. <div>
  76. <p>亲爱的祖国</p>
  77. </div>
  78. <div>
  79. <p>亲爱的祖国</p>
  80. </div>
  81. <div>
  82. <p>亲爱的祖国</p>
  83. </div>
  84. <div>
  85. <p>亲爱的祖国</p>
  86. </div>
  87. <div>
  88. <p>亲爱的祖国</p>
  89. </div>
  90. </div>
  91. </body>
  92. </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