Blogger Information
Blog 11
fans 0
comment 0
visits 27428
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
用grid放二手商品交易列表
饮雪煮茶
Original
749 people have browsed it

全部通过grid画盒子,嵌套做出来的。
元素对齐还有点问题。

html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>二手商品交易grid</title>
  6. <link rel="stylesheet" href="./public-second-hand.css">
  7. </head>
  8. <body>
  9. <div class="public-second-hand">
  10. <div class="public-second-title1">
  11. <a href="">抢好货</a>
  12. <span>0低价, 便捷,安全,快速</span>
  13. </div>
  14. <div class="public-second-title2">
  15. <h3>热门分类</h3>
  16. <a href="">美女写着</a>
  17. <a href="">日本美女</a>
  18. <a href="">美国美女</a>
  19. <a href="">国内美女</a>
  20. <a href="">AV美女</a>
  21. </div>
  22. <div class="public-second-content">
  23. <div class="public-second-list">
  24. <div class="public-second-item">
  25. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  26. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  27. <span><i>&yen;345</i><i>美女</i></span>
  28. </div>
  29. <div class="public-second-item">
  30. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  31. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  32. <span><i>&yen;345</i><i>美女</i></span>
  33. </div>
  34. <div class="public-second-item">
  35. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  36. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  37. <span><i>&yen;345</i><i>美女</i></span>
  38. </div>
  39. <div class="public-second-item">
  40. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  41. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  42. <span><i>&yen;345</i><i>美女</i></span>
  43. </div>
  44. <div class="public-second-item">
  45. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  46. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  47. <span><i>&yen;345</i><i>美女</i></span>
  48. </div>
  49. <div class="public-second-item">
  50. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  51. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  52. <span><i>&yen;345</i><i>美女</i></span>
  53. </div>
  54. <div class="public-second-item">
  55. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  56. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  57. <span><i>&yen;345</i><i>美女</i></span>
  58. </div>
  59. <div class="public-second-item">
  60. <a href=""><img src="./static/images/shop/shop1.jpg" alt=""></a>
  61. <p>美女性感写真海报墙艺术装饰画贴画图1</p>
  62. <span><i>&yen;345</i><i>美女</i></span>
  63. </div>
  64. </div>
  65. <div class="public-second-aside">
  66. <div class="public-second-quick">
  67. <img src="./static/images/ad/1.png" alt="">
  68. <img src="./static/images/ad/2.png" alt="">
  69. <img src="./static/images/ad/3.png" alt="">
  70. <img src="./static/images/ad/4.png" alt="">
  71. </div>
  72. <div class="public-second-ad">
  73. <img src="./static/images/ad/image.png" alt="">
  74. <img src="./static/images/ad/ad2.jpg" alt="">
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </body>
  80. </html>

css

  1. @import "./static/css/public_reset.css";
  2. .public-second-hand{
  3. width: 1200px;
  4. margin: 0 auto;
  5. background-color: #ffffff;
  6. padding: 10px;
  7. box-sizing: border-box;
  8. display: grid;
  9. grid-template-rows: 40px 40px 420px;
  10. grid-template-columns: 1fr;
  11. grid-column-gap: 10px;
  12. border-radius: 5px;
  13. }
  14. .public-second-hand:hover{
  15. box-shadow: 0 0 3px #888;
  16. }
  17. .public-second-hand > .public-second-title1{
  18. display: grid;
  19. grid-template-rows: 1fr;
  20. grid-template-columns: 90px 1fr;
  21. border-bottom: 1px solid #999;
  22. margin-bottom: 5px;
  23. }
  24. .public-second-hand > .public-second-title1 > a{
  25. font-size: 23px;
  26. align-self: end;
  27. }
  28. .public-second-hand > .public-second-title1 > span{
  29. color: #f00;
  30. align-self: end;
  31. }
  32. .public-second-hand > .public-second-title2 {
  33. display: grid;
  34. grid-template-rows: 1fr;
  35. grid-template-columns: 120px repeat(5,80px);
  36. }
  37. .public-second-hand > .public-second-title2 > h3{
  38. font-size: 23px;
  39. color: #f00;
  40. align-self: end;
  41. }
  42. .public-second-hand > .public-second-title2 >a {
  43. align-self: end;
  44. }
  45. .public-second-hand > .public-second-content {
  46. display: grid;
  47. grid-template-rows: 1fr;
  48. grid-template-columns: 2fr 1fr;
  49. margin-top: 15px;
  50. }
  51. .public-second-hand > .public-second-content > .public-second-list{
  52. /*height: 410px;*/
  53. padding: 10px;
  54. display: grid;
  55. grid-template-rows: repeat(2,1fr);
  56. grid-template-columns: repeat(4,1fr);
  57. box-sizing: border-box;
  58. }
  59. .public-second-hand > .public-second-content > .public-second-list > .public-second-item{
  60. width: 178px;
  61. height: 200px;
  62. display: grid;
  63. grid-template-rows: 130px 45px 25px;
  64. grid-template-columns: 1fr;
  65. }
  66. .public-second-hand > .public-second-content > .public-second-list > .public-second-item > span > i{
  67. font-style: normal;
  68. }
  69. .public-second-hand > .public-second-content > .public-second-list > .public-second-item > span{
  70. display: grid;
  71. grid-template-rows: 1fr;
  72. grid-template-columns: 140px 1fr;
  73. }
  74. .public-second-hand > .public-second-content > .public-second-list > .public-second-item > span > i:first-of-type{
  75. color: #f00;
  76. }
  77. .public-second-hand > .public-second-content > .public-second-list > .public-second-item > span > i:last-of-type{
  78. background-color: #55ce9f;
  79. height: 18px;
  80. padding: 0 5px;
  81. color: #fff;
  82. /*border-radius: 5px;*/
  83. }
  84. .public-second-hand > .public-second-content > .public-second-list img{
  85. width: 176px;
  86. height: 120px;
  87. border-radius: 5px;
  88. }
  89. .public-second-hand > .public-second-content > .public-second-aside > {
  90. padding: 10px;
  91. display: grid;
  92. grid-template-rows: repeat(2,400px);
  93. grid-template-columns: 1fr;
  94. box-sizing: border-box;
  95. }
  96. .public-second-hand > .public-second-content > .public-second-aside > .public-second-quick{
  97. display: grid;
  98. grid-template-rows: repeat(2,1fr);
  99. grid-template-columns: repeat(2,1fr);
  100. grid-row-gap: 10px;
  101. }
  102. .public-second-hand > .public-second-content > .public-second-aside > .public-second-quick > img{
  103. width: 190px;
  104. height: 130px;
  105. }
  106. .public-second-hand > .public-second-content > .public-second-aside > .public-second-ad {
  107. display: grid;
  108. grid-template-rows: 60px 60px;
  109. grid-template-columns: 1fr;
  110. grid-row-gap: 10px;
  111. }
  112. .public-second-hand > .public-second-content > .public-second-aside >.public-second-ad >img{
  113. width: 393px;
  114. height: 60px;
  115. }

效果图

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:全部用grid, 有点狠了点... 不过, 做为一个练习, 是一个不错的尝试... 其它前面的二个标题栏用flex会更方便, 下面的主体图文列表,非常适合用grid一步搞定
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