博客列表 >仿淘宝页面

仿淘宝页面

喜
原创
2022年07月19日 16:26:23335浏览

1.效果图

2.代码

  1. <body>
  2. <header>
  3. <a href="#" class="logo">
  4. <img src="../淘宝/1.png" alt="">
  5. </a>
  6. <a href="#" class="search">
  7. <span>寻找宝贝店铺</span>
  8. <span>搜索</span>
  9. </a>
  10. <a href="#" class="qdao">
  11. <img src="./2.png" alt="">
  12. </a>
  13. </header>
  14. <main>
  15. <ul class="navs">
  16. <li>
  17. <a href="#"><img src="./3.webp" alt="">
  18. <span>天猫新品</span></a>
  19. </li>
  20. <li>
  21. <a href="#"><img src="./4.webp" alt="">
  22. <span>今日新品</span></a>
  23. </li>
  24. <li>
  25. <a href="#"><img src="./5.webp" alt="">
  26. <span>天猫国际</span></a>
  27. </li>
  28. <li>
  29. <a href="#"><img src="./6.webp" alt="">
  30. <span>飞猪旅行</span></a>
  31. </li>
  32. <li>
  33. <a href="#"><img src="./7.webp" alt="">
  34. <span>天猫超市</span></a>
  35. </li>
  36. <li>
  37. <a href="#"><img src="./8.webp" alt="">
  38. <span>淘宝吃货</span></a>
  39. </li>
  40. <li>
  41. <a href="#"><img src="./9.webp" alt="">
  42. <span>省钱卡</span></a>
  43. </li>
  44. <li>
  45. <a href="#"><img src="./10.webp" alt="">
  46. <span>领淘金币</span></a>
  47. </li>
  48. <li>
  49. <a href="#"><img src="./11.webp" alt="">
  50. <span>阿里拍卖</span></a>
  51. </li>
  52. <li>
  53. <a href="#"><img src="./12.webp" alt="">
  54. <span>分类</span></a>
  55. </li>
  56. </ul>
  57. <ul class="entry">
  58. <li>
  59. <div class="left">
  60. <a href="#">
  61. <h4>聚划算</h4>
  62. <img src="./13.webp" alt="">
  63. <span>品牌折扣</span>
  64. </a>
  65. </div>
  66. <div class="right">
  67. <a href="#">
  68. <img src="./14.webp" alt="">
  69. </a>
  70. </div>
  71. </li>
  72. <li>
  73. <div class="left">
  74. <a href="#">
  75. <h4>天天特卖</h4>
  76. <img src="./15.webp" alt="">
  77. <span>1元秒杀</span>
  78. </a>
  79. </div>
  80. <div class="right">
  81. <a href="#">
  82. <img src="./16.webp" alt="">
  83. </a>
  84. </div>
  85. </li>
  86. <li>
  87. <div class="left">
  88. <a href="#">
  89. <h4>有好货</h4>
  90. <img src="./17.webp" alt="">
  91. <span style="background-color: rgb(0, 144, 234);">好口碑</span>
  92. </a>
  93. </div>
  94. <div class="right">
  95. <a href="#">
  96. <img src="./18.webp" alt="">
  97. </a>
  98. </div>
  99. </li>
  100. <li>
  101. <div class="left">
  102. <a href="#">
  103. <h4>每日好店</h4>
  104. <img src="./19.webp" alt="">
  105. <span style="background-color: rgb(255, 151, 17);">特色</span>
  106. </a>
  107. </div>
  108. <div class="right">
  109. <a href="#">
  110. <img src="./20.webp" alt="">
  111. </a>
  112. </div>
  113. </li>
  114. </ul>
  115. <ul class="items">
  116. <li style="height:2.5rem;">
  117. <a href="#"><img src="./21.webp" alt=""></a>
  118. </li>
  119. <li>
  120. <a href="#"><img src="./22.webp" alt=""></a>
  121. <div class="bottom">
  122. <span>韩国拉面锅网红金色煮面泡面锅泡面小食堂韩剧同款进口加厚黄铝锅</span>
  123. <p><span>¥ 18.9</span>100+人已购买</p>
  124. </div>
  125. </li>
  126. <li>
  127. <a href="#"><img src="./22.webp" alt=""></a>
  128. <div class="bottom">
  129. <span>韩国拉面锅网红金色煮面泡面锅泡面小食堂韩剧同款进口加厚黄铝锅</span>
  130. <p><span>¥ 18.9</span>100+人已购买</p>
  131. </div>
  132. </li>
  133. <li>
  134. <a href="#"><img src="./22.webp" alt=""></a>
  135. <div class="bottom">
  136. <span>韩国拉面锅网红金色煮面泡面锅泡面小食堂韩剧同款进口加厚黄铝锅</span>
  137. <p><span>¥ 18.9</span>100+人已购买</p>
  138. </div>
  139. </li>
  140. <li>
  141. <a href="#"><img src="./22.webp" alt=""></a>
  142. <div class="bottom">
  143. <span>韩国拉面锅网红金色煮面泡面锅泡面小食堂韩剧同款进口加厚黄铝锅</span>
  144. <p><span>¥ 18.9</span>100+人已购买</p>
  145. </div>
  146. </li>
  147. </ul>
  148. </main>
  149. <footer>
  150. <a href="#">
  151. <span class="iconfont icon-shejiaotubiao-44"></span>
  152. </a>
  153. <a href="#">
  154. <span class="iconfont icon-gouwuche"></span>
  155. <span>购物车</span>
  156. </a>
  157. <a href="#">
  158. <span class="iconfont icon-wodetaobao"></span>
  159. <span>我的淘宝</span>
  160. </a>
  161. <button>打开淘宝</button>
  162. </footer>
  163. </body>

css

  1. *{
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. a{
  7. text-decoration: none;
  8. color: #666;
  9. }
  10. li{
  11. list-style: none;
  12. }
  13. html {
  14. font-size: calc(100vw / 3.75);
  15. }
  16. body {
  17. font-size: 0.14rem;
  18. color: #333;
  19. background-color: #f4f4f4;
  20. padding: 0 0.1rem;
  21. }
  22. body img {
  23. width: 100%;
  24. }
  25. @media (max-width: 320px) {
  26. html {
  27. font-size: 85px;
  28. }
  29. }
  30. @media (min-width: 640px) {
  31. html {
  32. font-size: 170px;
  33. }
  34. }
  35. header,footer{
  36. position: fixed;
  37. width: 100vw;
  38. height: 0.5rem;
  39. }
  40. header{
  41. top: 0;
  42. left: 0;
  43. right: 0;
  44. display: grid;
  45. grid-template-columns: 0.55rem 1fr 0.33rem;
  46. place-items: center;
  47. gap: 0 0.13rem;
  48. padding: 0 0.1rem;
  49. background-color: #f4f4f4;
  50. z-index: 1;
  51. }
  52. header .search{
  53. display: flex;
  54. place-content: space-between;
  55. width: 100%;
  56. height: 0.35rem;
  57. padding-left: 0.1rem;
  58. border: 0.015rem solid #ff5000;
  59. border-radius: 0.5rem;
  60. background-color: #fff;
  61. line-height: 0.3rem;
  62. }
  63. header .search span:last-of-type{
  64. width: 0.64rem;
  65. height: 0.32rem;
  66. border: 0.01rem solid #fff;
  67. text-align: center;
  68. color: #fff;
  69. border-radius: 0.16rem;
  70. background: linear-gradient(to right, #FF8D0E, #FF5000);
  71. }
  72. footer{
  73. display: flex;
  74. place-content: space-around;
  75. background-color: #ffffff;
  76. bottom: 0;
  77. left: 0;
  78. right: 0;
  79. }
  80. footer a{
  81. display: grid;
  82. place-items: center;
  83. }
  84. footer span{
  85. font-size: 0.13rem;
  86. }
  87. footer a:first-of-type span{
  88. font-size: 0.38rem;
  89. color: #FF6D2A;
  90. }
  91. footer a:nth-of-type(n+2) .iconfont{
  92. font-size: 0.22rem;
  93. }
  94. footer>button{
  95. position: absolute;
  96. width: 1.16rem;
  97. font-size: 0.14rem;
  98. box-shadow: rgb(18 18 18 / 25%) 0px 2px 5px;
  99. background-color: rgb(255, 80, 0);
  100. color: rgb(255, 255, 255);
  101. border-radius: 0.18rem;
  102. line-height: 0.36rem;
  103. font-weight: bold;
  104. left: 50%;
  105. bottom: 0.6rem;
  106. font-family: Helvetica, sans-serif;
  107. transform: translate(-50%);
  108. border: none;
  109. }
  110. main{
  111. position: relative;
  112. top: 0.6rem;
  113. }
  114. main .navs{
  115. display: grid;
  116. grid-template-columns: repeat(5,1fr);
  117. gap: 0 0.1rem;
  118. background: #FFFFFF;
  119. border-radius: 0.12rem;
  120. background-color: #FFFFFF;
  121. padding: 0 0.03rem;
  122. padding-bottom: 0.1rem;
  123. text-align: center;
  124. font-size: 0.13rem;
  125. }
  126. main .entry{
  127. display: grid;
  128. grid-template-columns: repeat(2,1fr);
  129. margin-top: 0.1rem;
  130. border-radius: 0.12rem;
  131. background-color: #fff;
  132. }
  133. main .entry>li{
  134. display: grid;
  135. grid-template-columns: repeat(2,1fr);
  136. place-items: center;
  137. padding-top: 0.05rem;
  138. }
  139. main .entry>li .left{
  140. position: relative;
  141. }
  142. main .entry>li .left span{
  143. position: absolute;
  144. top: 4%;
  145. left: 70%;
  146. color: rgb(255, 255, 255);
  147. font-size: 0.11rem;
  148. background-color: rgb(255, 66, 0);
  149. border-radius: 0.02rem;
  150. padding: 0 0.03rem;
  151. margin-left: 0.03rem;
  152. line-height: 0.14rem;
  153. height: 0.14rem;
  154. white-space: nowrap;
  155. }
  156. main .entry>li:nth-of-type(2) span,
  157. main .entry>li:nth-of-type(4) span{
  158. left: 96%;
  159. }
  160. main .entry>li .left img{
  161. width: 0.63rem;
  162. height: 0.63rem;
  163. }
  164. main .entry>li .right img{
  165. width: 0.8rem;
  166. height: 0.8rem;
  167. }
  168. main .entry>li h4{
  169. font-size: 0.15rem;
  170. color: #111;
  171. }
  172. main .entry>li:nth-of-type(1),main .entry>li:nth-of-type(3){
  173. border-right: 1px solid #eeeded;
  174. }
  175. main .entry>li:nth-of-type(3),main .entry>li:nth-of-type(4){
  176. border-top: 1px solid #eeeded;
  177. }
  178. main .items{
  179. display: grid;
  180. grid-template-columns: repeat(2,1fr);
  181. grid-template-rows: 2.6rem;
  182. gap: 0.1rem;
  183. margin-top: 0.1rem;
  184. padding-bottom: 0.6rem;
  185. }
  186. main .items li{
  187. border-radius: 0.06rem;
  188. background-color: #fff;
  189. }
  190. main .items li img{
  191. border-radius: 0.06rem;
  192. }
  193. main .items .bottom {
  194. padding-left: 0.1rem;
  195. padding-right: 0.09rem;
  196. margin-top: 0.12rem;
  197. }
  198. main .items .bottom p{
  199. display: flex;
  200. margin: 0.11rem 0;
  201. align-items: center;
  202. font-size: 0.12rem;
  203. color: #999;
  204. }
  205. main .items .bottom p span{
  206. color: #ff5500;
  207. font-size: 0.14rem;
  208. padding-right: 0.05rem;
  209. }
  210. main .items span{
  211. font-size: 0.13rem;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. display: -webkit-box;
  215. -webkit-line-clamp: 2;
  216. -webkit-box-orient: vertical;
  217. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议