博客列表 >实例演示淘宝移动端商品列表

实例演示淘宝移动端商品列表

上草一方
上草一方原创
2022年04月01日 23:32:511053浏览

淘宝移动端商品列表

HTML代码如下:
<!-- 2.商品列表 -->

  1. <div class="list">
  2. <div class="title">--------你可能还喜欢--------</div>
  3. <div class="list-1">
  4. <div class="unit">
  5. <div class="img">
  6. <img src="images/items/item8.webp" alt="">
  7. </div>
  8. <div class="detail">
  9. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  10. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  11. </div>
  12. </div>
  13. <div class="unit">
  14. <div class="img">
  15. <img src="images/items/item20.webp" alt="">
  16. </div>
  17. <div class="detail">
  18. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  19. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  20. </div>
  21. </div>
  22. <div class="unit">
  23. <div class="img">
  24. <img src="images/items/item14.webp" alt="">
  25. </div>
  26. <div class="detail">
  27. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  28. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  29. </div>
  30. </div>
  31. <div class="unit">
  32. <div class="img">
  33. <img src="images/items/item15.webp" alt="">
  34. </div>
  35. <div class="detail">
  36. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  37. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  38. </div>
  39. </div>
  40. <div class="unit">
  41. <div class="img">
  42. <img src="images/items/item16.webp" alt="">
  43. </div>
  44. <div class="detail">
  45. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  46. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  47. </div>
  48. </div>
  49. <div class="unit">
  50. <div class="img">
  51. <img src="images/items/item17.webp" alt="">
  52. </div>
  53. <div class="detail">
  54. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  55. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  56. </div>
  57. </div>
  58. <div class="unit">
  59. <div class="img">
  60. <img src="images/items/item18.webp" alt="">
  61. </div>
  62. <div class="detail">
  63. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  64. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  65. </div>
  66. </div>
  67. <div class="unit">
  68. <div class="img">
  69. <img src="images/items/item19.webp" alt="">
  70. </div>
  71. <div class="detail">
  72. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  73. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  74. </div>
  75. </div>
  76. <div class="unit">
  77. <div class="img">
  78. <img src="images/items/item11.webp" alt="">
  79. </div>
  80. <div class="detail">
  81. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  82. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  83. </div>
  84. </div>
  85. <div class="unit">
  86. <div class="img">
  87. <img src="images/items/item11.webp" alt="">
  88. </div>
  89. <div class="detail">
  90. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  91. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  92. </div>
  93. </div>
  94. <div class="unit">
  95. <div class="img">
  96. <img src="images/items/item18.webp" alt="">
  97. </div>
  98. <div class="detail">
  99. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  100. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  101. </div>
  102. </div>
  103. <div class="unit">
  104. <div class="img">
  105. <img src="images/items/item19.webp" alt="">
  106. </div>
  107. <div class="detail">
  108. <div class="desc">商品描述商品描述,商品描述商品描述</div>
  109. <div class="price"><span class="iconfont icon-renminbifuhao">89</span>&nbsp;&nbsp;<span class="num">45人已购买</span></div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>

CSS代码如下:

  1. /* 你可能还喜欢的商品列表部分 */
  2. main .list{
  3. display: grid;
  4. place-items: center;
  5. }
  6. main .list .title{
  7. color: orangered;
  8. padding-top: 0.1rem;
  9. padding-bottom: 0.1rem;
  10. }
  11. main .list .list-1{
  12. display: grid;
  13. grid-template-columns: repeat(2,1fr);
  14. gap: 0.1rem;
  15. }
  16. main .list .list-1 .unit img{
  17. width: 100%;
  18. height: 100%;
  19. border-radius: 5px;
  20. }
  21. main .list .list-1 .unit .detail{
  22. display: grid;
  23. }
  24. main .list .list-1 .unit .detail .price{
  25. color:rgb(243, 22, 41) ;
  26. }
  27. main .list .list-1 .unit .num{
  28. color: #555;
  29. }

运行效果如下图:

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议