博客列表 >淘宝页面模仿

淘宝页面模仿

P粉036614676
P粉036614676原创
2022年07月20日 11:19:11495浏览

预览

代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <!-- 只用grid-template-columns,会自动到下面 -->
  5. <!-- 文字的padding和盒子的padding -->
  6. <!-- 只用grid-template-columns,会自动到下面 -->
  7. <!-- 文字的padding和盒子的padding -->
  8. <meta charset="UTF-8">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <title>移动端首页-1-整体</title>
  12. <link rel="stylesheet" href="./css/reset.css">
  13. <link rel="stylesheet" href="./font_ iconfont/iconfont.css">
  14. <link rel="stylesheet" href="./css/public.css">
  15. <link rel="stylesheet" href="./css/main.css">
  16. <style>
  17. *{
  18. padding: 0;
  19. margin: 0;
  20. box-sizing: border-box;
  21. }
  22. a{
  23. text-decoration: none;
  24. }
  25. li{
  26. list-style: none;
  27. }
  28. body{
  29. /* 吸色器 */
  30. font-size: 0.13rem;
  31. padding: 0 0.15rem;
  32. margin: auto;
  33. background-color: #f4f4f4;
  34. color: #333333;
  35. }
  36. html{
  37. font-size: calc(100vw / 3.75);
  38. }
  39. @media (max-width:320px) {
  40. html{
  41. font-size: 85px;
  42. }
  43. }
  44. @media (min-width:640px) {
  45. html{
  46. font-size: 170px;
  47. }
  48. }
  49. header,footer{
  50. position: fixed;
  51. height: 50px;
  52. left: 0;
  53. right: 0;
  54. background-color: #f4f4f4;
  55. display: grid;
  56. place-items: center;
  57. z-index: 100;
  58. }
  59. header{
  60. top: 0;
  61. grid-template-columns: 60px 1fr 30px;
  62. gap: 10px;
  63. }
  64. footer{
  65. bottom: 0;
  66. grid-template-columns: repeat(3,1fr);
  67. }
  68. /* 头部 */
  69. header a{
  70. width: 100%;
  71. }
  72. header a img{
  73. width: 100%;
  74. padding-left: 0.1rem;
  75. }
  76. .icon-qianbao{
  77. font-size: 0.2rem;
  78. color: rgb(255, 80, 0);
  79. padding-right: 0.1rem;
  80. }
  81. .top-middle{
  82. display: flex;
  83. width: 100%;
  84. place-content: space-between;
  85. place-items: center;
  86. border: 2px solid rgb(255, 80, 0);
  87. padding: 2px 0;
  88. border-radius: 20px;
  89. color: rgb(93, 85, 85);
  90. }
  91. .top-middle span:nth-of-type(2){
  92. padding: 0.03rem 0.08rem;
  93. background: linear-gradient(to left, #ff5000, #ffa000);
  94. color: white;
  95. border-radius: 0.2rem;
  96. margin-right: 0.02rem;
  97. }
  98. /* 尾部 */
  99. footer a{
  100. display: flex;
  101. flex-direction: column;
  102. place-items: center;
  103. color:rgb(255, 80, 0);
  104. }
  105. footer a:nth-of-type(1){
  106. font-size: 0.4rem;
  107. }
  108. footer a span:nth-of-type(1){
  109. font-size: larger;
  110. }
  111. main{
  112. background-color: #fff;
  113. min-height: 1500px;
  114. position: relative;
  115. top: 50px;
  116. }
  117. main .navs{
  118. display: grid;
  119. width: 100%;
  120. grid-template-columns: repeat(5,1fr);
  121. place-content: center;
  122. gap: 0 0.1rem;
  123. }
  124. main .navs li{
  125. display: grid;
  126. place-items: center;
  127. }
  128. img{
  129. width: 100%;
  130. }
  131. main .middle{
  132. display: grid;
  133. grid-template-columns: repeat(2,1fr);
  134. width: 100%;
  135. place-content: center;
  136. gap: 0.1rem;
  137. }
  138. main .middle li{
  139. display: grid;
  140. grid-template-columns: repeat(2,1fr);
  141. grid-template-rows: 0.2rem 0.8rem;
  142. }
  143. main .middle li div{
  144. grid-area: 1 / 1 /span 1 /span 2;
  145. display: flex;
  146. }
  147. main .middle li div span{
  148. padding: 0.01rem;
  149. background-color: rgb(255, 80, 0);
  150. border-radius: 0.08rem;
  151. }
  152. .list{
  153. display: grid;
  154. grid-template-columns: repeat(2,1fr);
  155. place-content: center;
  156. margin-top: 0.2rem;
  157. gap: 0.1rem 0.1rem;
  158. padding-bottom: 50px;
  159. }
  160. a{
  161. color: rgb(67, 66, 66);
  162. }
  163. main .list .item img {
  164. border-radius: 0.1rem 0.1rem 0 0;
  165. }
  166. .price{
  167. display: flex;
  168. width: 1.5rem;
  169. place-content: space-between;
  170. }
  171. .price span{
  172. font-size: smaller;
  173. }
  174. </style>
  175. </head>
  176. <body>
  177. <header>
  178. <a href=""><img src="./images/taobao.png" alt=""></a>
  179. <a href="" class="top-middle">
  180. <span>寻找宝贝店铺</span>
  181. <span>搜索</span>
  182. </a>
  183. <a class="iconfont icon-qianbao"></a>
  184. </header>
  185. <main>
  186. <ul class="navs">
  187. <li>
  188. <a href=""><img src="./images/navs/tmxb.webp" alt=""></a>
  189. <a href="">天猫新品</a>
  190. </li>
  191. <li>
  192. <a href=""><img src="./images/navs/jrbk.webp" alt=""></a>
  193. <a href="">今日爆款</a>
  194. </li>
  195. <li><a href="">
  196. <img src="./images/navs/tmgj.webp" alt=""></a>
  197. <a href="">天猫国际</a>
  198. </li>
  199. <li>
  200. <a href=""><img src="./images/navs/fzlx.webp" alt=""></a>
  201. <a href="">飞猪旅行</a>
  202. </li>
  203. <li>
  204. <a href=""><img src="./images/navs/tmcx.webp" alt=""></a>
  205. <a href="">天猫超市</a>
  206. </li>
  207. <li>
  208. <a href=""><img src="./images/navs/tbch.webp" alt=""></a>
  209. <a href="">淘宝吃货</a>
  210. </li>
  211. <li>
  212. <a href=""><img src="./images/navs/sqk.webp" alt=""></a>
  213. <a href="">省钱卡</a>
  214. </li>
  215. <li><a href="">
  216. <img src="./images/navs/ltjb.webp" alt=""></a>
  217. <a href="">领淘金币</a>
  218. </li>
  219. <li>
  220. <a href=""><img src="./images/navs/alpm.webp" alt=""></a>
  221. <a href="">阿里拍卖</a>
  222. </li>
  223. <li>
  224. <a href=""><img src="./images/navs/fl.webp" alt=""></a>
  225. <a href="">分类</a>
  226. </li>
  227. </ul>
  228. <ul class="middle">
  229. <li>
  230. <div>
  231. <h3>聚划算</h3>
  232. <span>品牌折扣</span>
  233. </div>
  234. <a href=""><img src="./images/items/item-1.webp"></a>
  235. <a href=""><img src="./images/items/item-2.webp" alt=""></a>
  236. </li>
  237. <li>
  238. <div>
  239. <h3>天天特价</h3>
  240. <span>一元秒杀</span>
  241. </div>
  242. <a href=""><img src="./images/items/item-3.webp" alt=""></a>
  243. <a href=""><img src="./images/items/item-4.webp" alt=""></a>
  244. </li>
  245. <li>
  246. <div>
  247. <h3>有好货</h3>
  248. <span>好口碑</span>
  249. </div>
  250. <a href=""><img src="./images/items/item-5.webp" alt=""></a>
  251. <a href=""><img src="./images/items/item-6.webp" alt=""></a>
  252. </li>
  253. <li>
  254. <div>
  255. <h3>每日好店</h3>
  256. <span>特色</span>
  257. </div>
  258. <a href=""><img src="./images/items/item-7.webp" alt=""></a>
  259. <a href=""><img src="./images/items/item-8.webp" alt=""></a>
  260. </li>
  261. </ul>
  262. <ul class="list">
  263. <li class="item">
  264. <a href=""><img src="images/items/item-9.webp" alt="" /></a>
  265. <div class="desc">
  266. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  267. <div class="price">
  268. <span class="iconfont icon-qianbao">288</span>
  269. <span>123人已购买</span>
  270. </div>
  271. </div>
  272. </li>
  273. <li class="item">
  274. <a href=""><img src="images/items/item-10.webp" alt="" /></a>
  275. <div class="desc">
  276. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  277. <div class="price">
  278. <span class="iconfont icon-qianbao">288</span>
  279. <span>123人已购买</span>
  280. </div>
  281. </div>
  282. </li>
  283. <li class="item">
  284. <a href=""><img src="images/items/item-11.webp" alt="" /></a>
  285. <div class="desc">
  286. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  287. <div class="price">
  288. <span class="iconfont icon-qianbao">288</span>
  289. <span>123人已购买</span>
  290. </div>
  291. </div>
  292. </li>
  293. <li class="item">
  294. <a href=""><img src="images/items/item-12.webp" alt="" /></a>
  295. <div class="desc">
  296. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  297. <div class="price">
  298. <span class="iconfont icon-qianbao">288</span>
  299. <span>123人已购买</span>
  300. </div>
  301. </div>
  302. </li>
  303. <li class="item">
  304. <a href=""><img src="images/items/item-13.webp" alt="" /></a>
  305. <div class="desc">
  306. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  307. <div class="price">
  308. <span class="iconfont icon-qianbao">288</span>
  309. <span>123人已购买</span>
  310. </div>
  311. </div>
  312. </li>
  313. <li class="item">
  314. <a href=""><img src="images/items/item-14.webp" alt="" /></a>
  315. <div class="desc">
  316. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  317. <div class="price">
  318. <span class="iconfont icon-qianbao">288</span>
  319. <span>123人已购买</span>
  320. </div>
  321. </div>
  322. </li>
  323. <li class="item">
  324. <a href=""><img src="images/items/item-15.webp" alt="" /></a>
  325. <div class="desc">
  326. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  327. <div class="price">
  328. <span class="iconfont icon-qianbao">288</span>
  329. <span>123人已购买</span>
  330. </div>
  331. </div>
  332. </li>
  333. <li class="item">
  334. <a href=""><img src="images/items/item-16.webp" alt="" /></a>
  335. <div class="desc">
  336. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  337. <div class="price">
  338. <span class="iconfont icon-qianbao">288</span>
  339. <span>123人已购买</span>
  340. </div>
  341. </div>
  342. </li>
  343. <li class="item">
  344. <a href=""><img src="images/items/item-17.webp" alt="" /></a>
  345. <div class="desc">
  346. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  347. <div class="price">
  348. <span class="iconfont icon-qianbao">288</span>
  349. <span>123人已购买</span>
  350. </div>
  351. </div>
  352. </li>
  353. <li class="item">
  354. <a href=""><img src="images/items/item-18.webp" alt="" /></a>
  355. <div class="desc">
  356. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  357. <div class="price">
  358. <span class="iconfont icon-qianbao">288</span>
  359. <span>123人已购买</span>
  360. </div>
  361. </div>
  362. </li>
  363. <li class="item">
  364. <a href=""><img src="images/items/item-19.webp" alt="" /></a>
  365. <div class="desc">
  366. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  367. <div class="price">
  368. <span class="iconfont icon-qianbao">288</span>
  369. <span>123人已购买</span>
  370. </div>
  371. </div>
  372. </li>
  373. <li class="item">
  374. <a href=""><img src="images/items/item-20.webp" alt="" /></a>
  375. <div class="desc">
  376. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  377. <div class="price">
  378. <span class="iconfont icon-qianbao">288</span>
  379. <span>123人已购买</span>
  380. </div>
  381. </div>
  382. </li>
  383. <li class="item">
  384. <a href=""><img src="images/items/item-21.webp" alt="" /></a>
  385. <div class="desc">
  386. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  387. <div class="price">
  388. <span class="iconfont icon-qianbao">288</span>
  389. <span>123人已购买</span>
  390. </div>
  391. </div>
  392. </li>
  393. <li class="item">
  394. <a href=""><img src="images/items/item-22.webp" alt="" /></a>
  395. <div class="desc">
  396. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  397. <div class="price">
  398. <span class="iconfont icon-qianbao">288</span>
  399. <span>123人已购买</span>
  400. </div>
  401. </div>
  402. </li>
  403. </ul>
  404. </main>
  405. <footer>
  406. <a href="" class="iconfont icon-shejiaotubiao-44"></a>
  407. <a href="">
  408. <span class="iconfont icon-gouwuche"></span>
  409. <span>购物车</span>
  410. </a>
  411. <a href="">
  412. <span class="iconfont icon-wode"></span>
  413. <span>我的淘宝</span>
  414. </a>
  415. </footer>
  416. </body>
  417. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议