Blogger Information
Blog 15
fans 0
comment 0
visits 10897
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Flex常用属性
P粉932932019
Original
574 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>Document</title>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. box-sizing: border-box;
  13. }
  14. .item-container {
  15. width: 100%;
  16. height: 800px;
  17. border: 5px solid rgb(11, 125, 240);
  18. display: flex; /* flex inline */
  19. /* flex-direction: column; column纵向排列,默认row */
  20. /* flex-direction: row; */
  21. /* 是否换行,默认nowrap */
  22. /* flex-wrap: wrap; */
  23. /* flex-flow是flex-direction和flex-wrap的简写 */
  24. flex-flow: row wrap;
  25. /* justify-content: center; 把所有元素化为一个整体的水平对齐方式 */
  26. /* justify-items: center; */
  27. /* align-content: center; 在有多行且有剩余空间时,把所有元素化为一个整体的对齐方式 */
  28. /* align-items: center; 把每一个单独元素作为一个整体的对齐方式,空间缩小后,元素的上下会有空白 */
  29. /* place-content是align-content和justify-content的简写,2个参数
  30. 项目在主轴上的排列与剩余空间分配,换行无间距 */
  31. /* place-content: center; */
  32. place-content: space-around space-between;
  33. /* place-items是align-items和justify-items的简写,2个参数
  34. 项目在交叉轴上的对齐方式*/
  35. /* place-items: end; */
  36. }
  37. .item{
  38. color: #fff;
  39. text-align: center;
  40. font-size: 20px;
  41. padding: 100px;
  42. }
  43. .item1{
  44. background: orange;
  45. /* order 子元素的排序,默认为0,数值越大越往后,可为负数 */
  46. order: 10;
  47. }
  48. .item2{
  49. background: rgb(135, 222, 136);
  50. /* 更改某个元素的对齐 */
  51. place-self: center;
  52. }
  53. .item3{
  54. background: red;
  55. font-size: 10px;
  56. }
  57. .item4{
  58. background: rgb(144, 19, 129);
  59. font-size: 80px;
  60. /* flex: 放大因子 收缩因子 计算宽度 默认:0 1 auto*/
  61. flex: 1 1 12rem;
  62. }
  63. .item5{
  64. background: rgb(18, 28, 171);
  65. /* 默认0,根据元素进行尺寸放大缩小 */
  66. flex-grow: 1;
  67. }
  68. p {
  69. margin-top: 250px;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <div class="item-container">
  75. <div class="item item1">item1</div>
  76. <div class="item item2">item2</div>
  77. <div class="item item3">item3</div>
  78. <div class="item item4">item4</div>
  79. <div class="item item5">item5</div>
  80. </div>
  81. </body>
  82. </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