Blogger Information
Blog 26
fans 0
comment 1
visits 10555
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1027作业
P粉751989631
Original
278 people have browsed it

实例演示隐式网格, 对齐方式与行列间隙的设置方式与使用场景、前提

隐式网格隐式网格

  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  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>隐式网格</title>
  8. </head>
  9. <body>
  10. <div class="container">
  11. <div class="item">item1</div>
  12. <div class="item">item2</div>
  13. <div class="item">item3</div>
  14. <div class="item">item4</div>
  15. <div class="item">item5</div>
  16. <div class="item">item6</div>
  17. <div class="item">item7</div>
  18. <div class="item">item8</div>
  19. <div class="item">item9</div>
  20. <div class="item other">item10</div>
  21. <div class="item other">item11</div>
  22. </div>
  23. <style>
  24. .container {
  25. width: 300px;
  26. height: 150px;
  27. display: grid;
  28. grid-template-columns: repeat(3, 1fr);
  29. grid-template-rows: repeat(3, 1fr);
  30. grid-auto-flow: row;
  31. grid-auto-rows: 50px;
  32. grid-auto-columns: 50px;
  33. }
  34. .container > .item {
  35. background-color: rgb(195, 189, 201);
  36. }
  37. .container > .item.other {
  38. background-color: rgb(165, 154, 154);
  39. }
  40. </style>
  41. </body>
  42. </html>

对齐方式与行列间隙
1.项目对齐的的对齐方式,使用场景和前提
对齐前提:必须存在剩余空间
对齐方式:”剩余空间”在”项目”之间的分配方式
使用场景:Grid: 剩余空间存在于”容器” 或 “单元格”
容器中:place-content, place-items
项目中:place-self
行列间隙:主要用于处理行和列之间的间隔
gap:垂直方向 水平方向

案例

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