Blogger Information
Blog 7
fans 0
comment 1
visits 4251
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1029作业 深刻理解grid实现12列栅格布局的原理与实现,并用它写一个页面
Vic
Original
640 people have browsed it

代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <link rel="stylesheet" href="style.css" />
  8. <style>
  9. * {
  10. text-decoration: none;
  11. }
  12. .row:nth-of-type(2){
  13. min-height: 60vh;
  14. }
  15. .header > a {
  16. margin-left: 5em;
  17. }
  18. .header > a:first-of-type{
  19. margin-right: 8em;
  20. }
  21. .left{
  22. display: grid;
  23. place-content: center;
  24. width: ;
  25. }
  26. .mainbox{
  27. display: grid;
  28. grid-template-rows: 3em;
  29. grid-auto-rows: 3em;
  30. gap: 1em
  31. }
  32. .mainbox > .box{
  33. /* place-self: center; */
  34. background-color: yellow;
  35. border: 1px solid;
  36. mar
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="container">
  42. <!-- 头部 -->
  43. <div class="row">
  44. <div class="item col-12">
  45. <div class="header">
  46. <a href="">首页</a>
  47. <a href="">视频教程</a>
  48. <a href="">入门教程</a>
  49. <a href="">社区问答</a>
  50. <a href="">技术文章</a>
  51. <a href="">资源下载</a>
  52. </div>
  53. </div>
  54. </div>
  55. <!-- 主体 -->
  56. <div class="row">
  57. <div class="item col-3">
  58. <div class="left">
  59. <img src="https://www.php.cn/static/images/index_learn_first.jpg" alt="">
  60. </div>
  61. </div>
  62. <div class="item col-9">
  63. <div class="mainbox">
  64. <div class="box">文字1</div>
  65. <div class="box">文字2</div>
  66. <div class="box">文字3</div>
  67. <div class="box">文字4</div>
  68. <div class="box">文字5</div>
  69. <div class="box">文字6</div>
  70. </div>
  71. </div>
  72. </div>
  73. <!-- 底部 -->
  74. <div class="row">
  75. <div class="item col-12">
  76. <p>Copyright 2014-2020 https://www.php.cn/ All Rights Reserved | 苏州跃动光标网络科技有限公司 | 苏ICP备2020058653号-1</p>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </body>
  82. </html>

效果如下:

Correcting teacher:天蓬老师天蓬老师

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