Blogger Information
Blog 19
fans 0
comment 1
visits 7421
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1027作业
移动用户-4050479
Original
361 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. .css {
  10. display: grid;
  11. grid-template-rows: repeat(3 , 80px);
  12. grid-template-columns: 80px 80px 80px ;
  13. /* 排序规则,默认横向排列 */
  14. grid-auto-flow: row;
  15. grid-auto-rows: 80px;/* 行优先设置行高 */
  16. grid-auto-flow:column;/* 列优先 */
  17. grid-auto-columns: 80px;/* 设置列宽 */
  18. }
  19. .css > .vb {
  20. background-color: aqua;
  21. border: 1px solid violet;
  22. width: 40px;
  23. height: 40px;
  24. }
  25. /* 容器创建剩余空间 */
  26. .css {
  27. width: 400px;
  28. height: 400px;
  29. background-color: yellowgreen;
  30. /* 对齐方式 */
  31. /* place-content: 水平方向 垂直方向; */
  32. /* place-content: start start ; 这是默认方式 */
  33. place-content: center; /* 或者 place-content: center center; */
  34. /* 单元格对齐 :单元格对齐要保证单元格有剩余空间 和容器一样 */
  35. place-items: center;
  36. place-content: space-between;
  37. place-content: space-around;
  38. }
  39. .css > .vb:nth-last-of-type(-1n + 2){
  40. display: none;
  41. background-color: blueviolet;
  42. }
  43. .css > .vb:nth-of-type(5) {
  44. place-self: end center; /* 单独设置某一个元素定位 */
  45. background-color: brown;
  46. }
  47. /**
  48. *
  49. * * 1. 对齐前提 : 有剩余空间 ,
  50. * * 2. 对齐方案 : 剩余空间在项目之间的分配
  51. * * 3. 剩余空间 : flex(主轴 ,交叉轴) Grid (容器 , 单元格)
  52. *
  53. */
  54. .vm {
  55. display: grid;
  56. grid-template-rows: repeat(3 , 80px);
  57. grid-template-columns: 80px 80px 80px ;
  58. /* 排序规则,默认横向排列 */
  59. grid-auto-rows: 80px;/* 行优先设置行高 */
  60. grid-auto-columns: 80px;/* 设置列宽 */
  61. margin-top: 10px;
  62. /* 设置间隙 */
  63. /* gap: 垂直方向 水平方向; */
  64. gap: 5px 5px;
  65. }
  66. .vm > .vb {
  67. background-color: aqua;
  68. }
  69. </STyle>
  70. </head>
  71. <body>
  72. <div class="css">
  73. <div class="vb">1</div>
  74. <div class="vb">2</div>
  75. <div class="vb">3</div>
  76. <div class="vb">4</div>
  77. <div class="vb">5</div>
  78. <div class="vb">6</div>
  79. <div class="vb">7</div>
  80. <div class="vb">8</div>
  81. <div class="vb">9</div>
  82. <!-- !隐式网格 -->
  83. <div class="vb">10</div>
  84. <div class="vb">11</div>
  85. </div>
  86. <div class="vm">
  87. <div class="vb">1</div>
  88. <div class="vb">2</div>
  89. <div class="vb">3</div>
  90. <div class="vb">4</div>
  91. <div class="vb">5</div>
  92. <div class="vb">5</div>
  93. </div>
  94. </body>
  95. </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