模仿淘宝网

编辑: admin 分类: 电脑知识 发布时间: 2023-06-14 来源:互联网
模仿淘宝网效果图

HTML文件
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="initial-scale=1.0">
  7. <!-- <link rel="stylesheet" href="css/reset.css"> -->
  8. <!-- <link rel="stylesheet" href="font_icon/iconfont.css"> -->
  9. <link rel="stylesheet" href="css/header.css">
  10. <!-- <link rel="stylesheet" href="css/footer.css"> -->
  11. <title>Document</title>
  12. </head>
  13. <body>
  14. <!-- 页眉 -->
  15. <header>
  16. <!-- logo -->
  17. <a class="logo" href="https://main.m.taobao.com/">
  18. <img src="images/taobao.png" alt="">
  19. </a>
  20. <!-- 搜索框 -->
  21. <a href="https://main.m.taobao.com/search/index.html?spm=a215s.7406091.topbar.1.560c6770t1leU1" class="search">
  22. <span>寻找宝贝店铺</span>
  23. <span>搜索</span>
  24. </a>
  25. <!-- 签到图标 -->
  26. <a href="" class="iconfont icon-qiandao-xuanzhong"></a>
  27. </header>
  28. <main>
  29. <!-- 顶部导航 -->
  30. <ul class="navs">
  31. <li class="item">
  32. <a href=""><img src="images/navs/tmxb.webp" alt=""></a>
  33. <a href="">天猫新品</a>
  34. </li>
  35. <li class="item">
  36. <a href=""><img src="images/navs/jrbk.webp" alt="" /></a>
  37. <a href="">今日爆款</a>
  38. </li>
  39. <li class="item">
  40. <a href=""><img src="images/navs/tmgj.webp" alt="" /></a>
  41. <a href="">天猫国际</a>
  42. </li>
  43. <li class="item">
  44. <a href=""><img src="images/navs/fzlx.webp" alt="" /></a>
  45. <a href="">飞猪旅行</a>
  46. </li>
  47. <li class="item">
  48. <a href=""><img src="images/navs/tmcx.webp" alt="" /></a>
  49. <a href="">天猫超市</a>
  50. </li>
  51. <li class="item">
  52. <a href=""><img src="images/navs/tbch.webp" alt="" /></a>
  53. <a href="">淘宝吃货</a>
  54. </li>
  55. <li class="item">
  56. <a href=""><img src="images/navs/sqk.webp" alt="" /></a>
  57. <a href="">省钱卡</a>
  58. </li>
  59. <li class="item">
  60. <a href=""><img src="images/navs/ltjb.webp" alt="" /></a>
  61. <a href="">领淘金币</a>
  62. </li>
  63. <li class="item">
  64. <a href=""><img src="images/navs/alpm.webp" alt="" /></a>
  65. <a href="">阿里拍卖</a>
  66. </li>
  67. <li class="item">
  68. <a href=""><img src="images/navs/fl.webp" alt="" /></a>
  69. <a href="">分类</a>
  70. </li>
  71. </ul>
  72. <!-- 快速入口 -->
  73. <ul class="entry">
  74. <li class="item">
  75. <div class="title">
  76. <h3>聚划算</h3>
  77. <span>礼遇记</span>
  78. </div>
  79. <a href=""><img src="images/items/item-1.webp" alt=""></a>
  80. <a href=""><img src="images/items/item-2.webp" alt=""></a>
  81. </li>
  82. <li class="item">
  83. <div class="title">
  84. <h3>天天特卖</h3>
  85. <span>1元秒杀</span>
  86. </div>
  87. <a href=""><img src="images/items/item-3.webp" alt="" /></a>
  88. <a href=""><img src="images/items/item-4.webp" alt="" /></a>
  89. </li>
  90. <li class="item">
  91. <div class="title">
  92. <h3>有好货</h3>
  93. <span style="background-color: deepskyblue">好口碑</span>
  94. </div>
  95. <a href=""><img src="images/items/item-5.webp" alt="" /></a>
  96. <a href=""><img src="images/items/item-6.webp" alt="" /></a>
  97. </li>
  98. <li class="item">
  99. <div class="title">
  100. <h3>每日好店</h3>
  101. <span style="background-color: orange">特色</span>
  102. </div>
  103. <a href=""><img src="images/items/item-7.webp" alt="" /></a>
  104. <a href=""><img src="images/items/item-8.webp" alt="" /></a>
  105. </li>
  106. </ul>
  107. <!-- 商品列表 -->
  108. <ul class="list">
  109. <li class="item">
  110. <a href=""><img src="images/items/item-9.webp" alt=""></a>
  111. <div class="desc">
  112. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  113. <div class="price">
  114. <span class="iconfont icon-renminbi_o">69</span>
  115. <span>200+人已购买</span>
  116. </div>
  117. </div>
  118. </li>
  119. <li class="item">
  120. <a href=""><img src="images/items/item-10.webp" alt="" /></a>
  121. <div class="desc">
  122. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  123. <div class="price">
  124. <span class="iconfont icon-renminbi_o">288</span>
  125. <span>123人已购买</span>
  126. </div>
  127. </div>
  128. </li>
  129. <li class="item">
  130. <a href=""><img src="images/items/item-11.webp" alt="" /></a>
  131. <div class="desc">
  132. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  133. <div class="price">
  134. <span class="iconfont icon-renminbi_o">288</span>
  135. <span>123人已购买</span>
  136. </div>
  137. </div>
  138. </li>
  139. <li class="item">
  140. <a href=""><img src="images/items/item-12.webp" alt="" /></a>
  141. <div class="desc">
  142. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  143. <div class="price">
  144. <span class="iconfont icon-renminbi_o">288</span>
  145. <span>123人已购买</span>
  146. </div>
  147. </div>
  148. </li>
  149. <li class="item">
  150. <a href=""><img src="images/items/item-13.webp" alt="" /></a>
  151. <div class="desc">
  152. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  153. <div class="price">
  154. <span class="iconfont icon-renminbi_o">288</span>
  155. <span>123人已购买</span>
  156. </div>
  157. </div>
  158. </li>
  159. <li class="item">
  160. <a href=""><img src="images/items/item-14.webp" alt="" /></a>
  161. <div class="desc">
  162. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  163. <div class="price">
  164. <span class="iconfont icon-renminbi_o">288</span>
  165. <span>123人已购买</span>
  166. </div>
  167. </div>
  168. </li>
  169. <li class="item">
  170. <a href=""><img src="images/items/item-15.webp" alt="" /></a>
  171. <div class="desc">
  172. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  173. <div class="price">
  174. <span class="iconfont icon-renminbi_o">288</span>
  175. <span>123人已购买</span>
  176. </div>
  177. </div>
  178. </li>
  179. <li class="item">
  180. <a href=""><img src="images/items/item-16.webp" alt="" /></a>
  181. <div class="desc">
  182. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  183. <div class="price">
  184. <span class="iconfont icon-renminbi_o">288</span>
  185. <span>123人已购买</span>
  186. </div>
  187. </div>
  188. </li>
  189. <li class="item">
  190. <a href=""><img src="images/items/item-17.webp" alt="" /></a>
  191. <div class="desc">
  192. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  193. <div class="price">
  194. <span class="iconfont icon-renminbi_o">288</span>
  195. <span>123人已购买</span>
  196. </div>
  197. </div>
  198. </li>
  199. <li class="item">
  200. <a href=""><img src="images/items/item-18.webp" alt="" /></a>
  201. <div class="desc">
  202. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  203. <div class="price">
  204. <span class="iconfont icon-renminbi_o">288</span>
  205. <span>123人已购买</span>
  206. </div>
  207. </div>
  208. </li>
  209. <li class="item">
  210. <a href=""><img src="images/items/item-19.webp" alt="" /></a>
  211. <div class="desc">
  212. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  213. <div class="price">
  214. <span class="iconfont icon-renminbi_o">288</span>
  215. <span>123人已购买</span>
  216. </div>
  217. </div>
  218. </li>
  219. <li class="item">
  220. <a href=""><img src="images/items/item-20.webp" alt="" /></a>
  221. <div class="desc">
  222. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  223. <div class="price">
  224. <span class="iconfont icon-renminbi_o">288</span>
  225. <span>123人已购买</span>
  226. </div>
  227. </div>
  228. </li>
  229. <li class="item">
  230. <a href=""><img src="images/items/item-21.webp" alt="" /></a>
  231. <div class="desc">
  232. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  233. <div class="price">
  234. <span class="iconfont icon-renminbi_o">288</span>
  235. <span>123人已购买</span>
  236. </div>
  237. </div>
  238. </li>
  239. <li class="item">
  240. <a href=""><img src="images/items/item-22.webp" alt="" /></a>
  241. <div class="desc">
  242. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  243. <div class="price">
  244. <span class="iconfont icon-renminbi_o">288</span>
  245. <span>123人已购买</span>
  246. </div>
  247. </div>
  248. </li>
  249. </ul>
  250. </main>
  251. <footer>
  252. <a href="" class="iconfont icon-taobao"></a>
  253. <a href="">
  254. <span class="iconfont icon-gouwuche"></span>
  255. <span>购物车</span>
  256. </a>
  257. <a href="">
  258. <span class="iconfont icon-wode"></span>
  259. <span>我的淘宝</span>
  260. </a>
  261. </footer>
  262. </body>
  263. </html>
css样式文件
  1. @import url('reset.css');
  2. @import url('../font_icon/iconfont.css');
  3. /* 页眉样式 */
  4. header{
  5. top: 0;
  6. left: 0;
  7. right: 0;
  8. display: grid;
  9. /* 一行三列 58px宽度 一等分 33px宽度 */
  10. grid-template-columns: 0.58rem 1fr 0.33rem;
  11. /* 行高 */
  12. grid-auto-rows: 0.5rem;
  13. /* 水平垂直居中 */
  14. place-items: center;
  15. /* 间隙 */
  16. gap: 0.1rem;
  17. background-color: #f4f4f4;
  18. }
  19. header a.logo{
  20. padding-left: 0.1rem;
  21. }
  22. header > a.search{
  23. width: 100%;
  24. border: 1px solid #ff5000;
  25. height: 0.35rem;
  26. /* 椭圆形 */
  27. border-radius: 0.3rem;
  28. display: flex;
  29. /* flex布局 两端对齐 */
  30. place-content: space-between;
  31. place-items: center;
  32. }
  33. /* 搜索框中的第一个文本 */
  34. header > a.search > span:first-child{
  35. padding-left: 0.1rem;
  36. }
  37. /* 搜索框中的最后一个文本 */
  38. header > a.search > span:last-child{
  39. padding: 0.06rem 0.2rem;
  40. /* 渐变背景 */
  41. background: linear-gradient(to left, #ff5000, #ffc000);
  42. color: #fff;
  43. border-radius: 0.3rem;
  44. margin-right: 0.01rem;
  45. }
  46. /* 签到图标 */
  47. header > a.iconfont{
  48. color: #ff5000;
  49. font-size: 0.24rem;
  50. }
  51. header,footer{
  52. height: 50px;
  53. /* 页眉页脚固定定位 */
  54. position: fixed;
  55. z-index: 999;
  56. }
  57. /* 页脚样式 */
  58. footer{
  59. bottom: 0;
  60. left: 0;
  61. right: 0;
  62. }
  63. footer{
  64. border-top: 1px solid #ccc;
  65. background-color: #fff;
  66. display: grid;
  67. grid-template-columns: repeat(3,1fr);
  68. place-content: space-around;
  69. font-size: xx-small;
  70. }
  71. footer > a{
  72. display: grid;
  73. place-items: center;
  74. }
  75. footer > a:first-child{
  76. color: #ff5000;
  77. font-size: 0.35rem;
  78. }
  79. footer a:first-child + a > span.iconfont{
  80. font-size: x-large;
  81. }
  82. /* 主体样式 */
  83. main{
  84. min-height: 2000px;
  85. /* 相对定位把整个主体乡下偏移50px */
  86. position: relative;
  87. top: 50px;
  88. /* 最底部的内容全部显示 */
  89. margin-bottom: 100px;
  90. /* 溢出隐藏 */
  91. overflow: hidden;
  92. }
  93. /* 顶部导航 */
  94. main .navs{
  95. display: grid;
  96. grid-template-columns: repeat(5,1fr);
  97. gap: 0 0.1rem;
  98. padding: 0 0.15rem 0.1rem;
  99. background-color: #fff;
  100. border: 1px solid #fff;
  101. border-radius: 0.2rem;
  102. }
  103. main .navs .item{
  104. display: grid;
  105. place-items: center;
  106. }
  107. /* 快速入口 */
  108. main > .entry{
  109. margin-top: 0.1rem;
  110. display: grid;
  111. grid-template-columns: repeat(2,1fr);
  112. padding: 0.1rem;
  113. background-color: #fff;
  114. border-radius: 0.15rem;
  115. }
  116. main > .entry .item{
  117. display: grid;
  118. grid-template-columns: repeat(2,1fr);
  119. padding: 0.1rem;
  120. border-right: 1px solid #dedede;
  121. }
  122. main > .entry .item .title{
  123. grid-column: span 2;
  124. display: flex;
  125. place-items: center;
  126. }
  127. main > .entry .item:nth-child(-n + 2){
  128. border-bottom: 1px solid #dedede;
  129. }
  130. main > .entry .item:nth-child(even){
  131. border-right: none;
  132. }
  133. main > .entry .item:first-child{
  134. background: linear-gradient(to right bottom, rgb(254, 230, 215), #fff 90px);
  135. }
  136. main > .entry .item .title > span{
  137. background-color: #ff5000;
  138. color:#fff;
  139. }
  140. main > .entry .item:nth-child(2){
  141. background: linear-gradient(to left bottom, rgb(255, 230, 234), #fff 90px);
  142. }
  143. /* 商品列表 */
  144. main > .list{
  145. margin-top: 0.1rem;
  146. display: grid;
  147. grid-template-columns: repeat(2,1fr);
  148. gap: 0.1rem
  149. }
  150. main > .list .item{
  151. background-color: #fff;
  152. border-radius: 0.15rem;
  153. }
  154. main > .list .item img{
  155. border-radius: 0.15rem 0.15rem 0 0;
  156. }
  157. main > .list .item .price .iconfont{
  158. color: #ff5000;
  159. }
  160. main > .list .item .price span:last-child{
  161. color: #bbb;
  162. font-size: x-small;
  163. }
  164. main > .list .item .desc{
  165. padding: 0.15rem;
  166. }
【本文转自:海外高防服务器 http://www.558idc.com/krgf.html 欢迎留下您的宝贵建议】