Blogger Information
Blog 35
fans 0
comment 0
visits 16769
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
grid初尝试
手机用户311660634
Original
365 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>grid 初尝试</title>
  8. </head>
  9. <body>
  10. <div class="rongqi">
  11. <div class="test1"><h2>1</h2></div>
  12. <div class="test2"><h2>3</h2></div>
  13. <div class="test3"><h2>5</h2></div>
  14. <div class="test4"><h2>7</h2></div>
  15. <div class="test5"><h2>9</h2></div>
  16. <div class="test6"><h2>11</h2></div>
  17. </div>
  18. <style>
  19. .rongqi {
  20. width: 1000px;
  21. height: 500px;
  22. /* 设置容器 */
  23. display: grid;
  24. /* 设置三列,每列200像素 */
  25. grid-template-columns: repeat(3, 100px);
  26. /* 设置三行,每行100像素 */
  27. grid-template-rows: repeat(3,50px);
  28. /* 设置项目在单元格中居中 */
  29. place-items: center;
  30. /* 设置容器内项目间隙20像素 */
  31. gap: 20px;
  32. }
  33. .rongqi > .test1 {
  34. grid-area: 1 / 1 / span 1 / span 1;
  35. place-self: end ;
  36. }
  37. .rongqi > .test2 {
  38. grid-area: 1 / 3/ span 1/ span 1;
  39. place-self: end ;
  40. }
  41. .rongqi > .test3 {
  42. grid-area: 2 / 2/ span 1/ span 1;
  43. }
  44. .rongqi > .test4 {
  45. grid-area: 3 / 1/ span 1/ span 1;
  46. place-self: start;
  47. }
  48. .rongqi > .test5 {
  49. grid-area: 3 / 3/ span 1/ span 1 ;
  50. place-self: end;
  51. }
  52. /* 隐式网格 */
  53. .rongqi > .test6 {
  54. grid-area: 4 / 2/ span 1/ span 1 ;
  55. }
  56. </style>
  57. </body>
  58. </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