博客列表 >仿造移动端淘宝网首页部分

仿造移动端淘宝网首页部分

P粉479712293
P粉479712293原创
2022年07月30日 13:37:29356浏览

仿造移动端淘宝网首页部分:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="stylesheet" href="../static/第13章/index2.css">
  8. <title>仿造移动端淘宝网首页部分</title>
  9. </head>
  10. <body>
  11. <!-- *1.页眉 -->
  12. <header>
  13. <!-- *1淘宝logo -->
  14. <a href="" class="logo"><img src="../static/images13/taobao.png" alt=""></a>
  15. <!-- *2搜索框 -->
  16. <a href="" class="search">
  17. <span>寻找宝贝店铺</span>
  18. <span>搜索</span>
  19. </a>
  20. <!-- *3签到图标 -->
  21. <a href="" class="iconfont icon-qiandao"></a>
  22. </header>
  23. <!-- *2.主体 -->
  24. <main>
  25. <!-- *1顶部导航 -->
  26. <ul class="navs">
  27. <li class="item" onclick="">
  28. <a href=""><img src="../static/images13/navs/tmxb.webp" alt=""></a>
  29. <a href="">天猫新品</a>
  30. </li>
  31. <li class="item" onclick="">
  32. <a href=""><img src="../static/images13/navs/jrbk.webp" alt=""></a>
  33. <a href="">今日爆款</a>
  34. </li>
  35. <li class="item" onclick="">
  36. <a href=""><img src="../static/images13/navs/tmgj.webp" alt=""></a>
  37. <a href="">天猫国际</a>
  38. </li>
  39. <li class="item" onclick="">
  40. <a href=""><img src="../static/images13/navs/fzlx.webp" alt=""></a>
  41. <a href="">飞猪旅行</a>
  42. </li>
  43. <li class="item" onclick="">
  44. <a href=""><img src="../static/images13/navs/tmcx.webp" alt=""></a>
  45. <a href="">天猫超市</a>
  46. </li>
  47. <li class="item" onclick="">
  48. <a href=""><img src="../static/images13/navs/tbch.webp" alt=""></a>
  49. <a href="">淘宝吃货</a>
  50. </li>
  51. <li class="item" onclick="">
  52. <a href=""><img src="../static/images13/navs/sqk.webp" alt=""></a>
  53. <a href="">省钱卡</a>
  54. </li>
  55. <li class="item" onclick="">
  56. <a href=""><img src="../static/images13/navs/ltjb.webp" alt=""></a>
  57. <a href="">领淘金币</a>
  58. </li>
  59. <li class="item" onclick="">
  60. <a href=""><img src="../static/images13/navs/alpm.webp" alt=""></a>
  61. <a href="">阿里拍卖</a>
  62. </li>
  63. <li class="item" onclick="">
  64. <a href=""><img src="../static/images13/navs/fl.webp" alt=""></a>
  65. <a href="">分类</a>
  66. </li>
  67. </ul>
  68. <!-- *快速入口 -->
  69. <ul class="entry">
  70. <li class="item">
  71. <div class="title">
  72. <h3>聚划算</h3>
  73. <span>品牌折扣</span>
  74. </div>
  75. <a href=""><img src="../static/images13/items/item-1.webp" alt="" /></a>
  76. <a href=""><img src="../static/images13/items/item-2.webp" alt="" /></a>
  77. </li>
  78. <li class="item">
  79. <div class="title">
  80. <h3>天天特卖</h3>
  81. <span>1元秒杀</span>
  82. </div>
  83. <a href=""><img src="../static/images13/items/item-3.webp" alt="" /></a>
  84. <a href=""><img src="../static/images13/items/item-4.webp" alt="" /></a>
  85. </li>
  86. <li class="item">
  87. <div class="title">
  88. <h3>有好货</h3>
  89. <span style="background-color: deepskyblue">好口碑</span>
  90. </div>
  91. <a href=""><img src="../static/images13/items/item-5.webp" alt="" /></a>
  92. <a href=""><img src="../static/images13/items/item-6.webp" alt="" /></a>
  93. </li>
  94. <li class="item">
  95. <div class="title">
  96. <h3>每日好店</h3>
  97. <span style="background-color: orange">特色</span>
  98. </div>
  99. <a href=""><img src="../static/images13/items/item-7.webp" alt="" /></a>
  100. <a href=""><img src="../static/images13/items/item-8.webp" alt="" /></a>
  101. </li>
  102. </ul>
  103. <!-- *商品列表 -->
  104. <ul class="list">
  105. <li class="item">
  106. <a href=""><img src="../static/images13/items/item-9.webp" alt="" /></a>
  107. <div class="desc">
  108. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  109. <div class="price">
  110. <span class="iconfont icon-renminbi">288</span>
  111. <span>123人已购买</span>
  112. </div>
  113. </div>
  114. </li>
  115. <li class="item">
  116. <a href=""><img src="../static/images13/items/item-10.webp" alt="" /></a>
  117. <div class="desc">
  118. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  119. <div class="price">
  120. <span class="iconfont icon-renminbi">288</span>
  121. <span>123人已购买</span>
  122. </div>
  123. </div>
  124. </li>
  125. <li class="item">
  126. <a href=""><img src="../static/images13/items/item-11.webp" alt="" /></a>
  127. <div class="desc">
  128. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  129. <div class="price">
  130. <span class="iconfont icon-renminbi">288</span>
  131. <span>123人已购买</span>
  132. </div>
  133. </div>
  134. </li>
  135. <li class="item">
  136. <a href=""><img src="../static/images13/items/item-12.webp" alt="" /></a>
  137. <div class="desc">
  138. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  139. <div class="price">
  140. <span class="iconfont icon-renminbi">288</span>
  141. <span>123人已购买</span>
  142. </div>
  143. </div>
  144. </li>
  145. <li class="item">
  146. <a href=""><img src="../static/images13/items/item-13.webp" alt="" /></a>
  147. <div class="desc">
  148. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  149. <div class="price">
  150. <span class="iconfont icon-renminbi">288</span>
  151. <span>123人已购买</span>
  152. </div>
  153. </div>
  154. </li>
  155. <li class="item">
  156. <a href=""><img src="../static/images13/items/item-14.webp" alt="" /></a>
  157. <div class="desc">
  158. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  159. <div class="price">
  160. <span class="iconfont icon-renminbi">288</span>
  161. <span>123人已购买</span>
  162. </div>
  163. </div>
  164. </li>
  165. <li class="item">
  166. <a href=""><img src="../static/images13/items/item-15.webp" alt="" /></a>
  167. <div class="desc">
  168. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  169. <div class="price">
  170. <span class="iconfont icon-renminbi">288</span>
  171. <span>123人已购买</span>
  172. </div>
  173. </div>
  174. </li>
  175. <li class="item">
  176. <a href=""><img src="../static/images13/items/item-16.webp" alt="" /></a>
  177. <div class="desc">
  178. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  179. <div class="price">
  180. <span class="iconfont icon-renminbi">288</span>
  181. <span>123人已购买</span>
  182. </div>
  183. </div>
  184. </li>
  185. <li class="item">
  186. <a href=""><img src="../static/images13/items/item-17.webp" alt="" /></a>
  187. <div class="desc">
  188. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  189. <div class="price">
  190. <span class="iconfont icon-renminbi">288</span>
  191. <span>123人已购买</span>
  192. </div>
  193. </div>
  194. </li>
  195. <li class="item">
  196. <a href=""><img src="../static/images13/items/item-18.webp" alt="" /></a>
  197. <div class="desc">
  198. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  199. <div class="price">
  200. <span class="iconfont icon-renminbi">288</span>
  201. <span>123人已购买</span>
  202. </div>
  203. </div>
  204. </li>
  205. <li class="item">
  206. <a href=""><img src="../static/images13/items/item-19.webp" alt="" /></a>
  207. <div class="desc">
  208. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  209. <div class="price">
  210. <span class="iconfont icon-renminbi">288</span>
  211. <span>123人已购买</span>
  212. </div>
  213. </div>
  214. </li>
  215. <li class="item">
  216. <a href=""><img src="../static/images13/items/item-20.webp" alt="" /></a>
  217. <div class="desc">
  218. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  219. <div class="price">
  220. <span class="iconfont icon-renminbi">288</span>
  221. <span>123人已购买</span>
  222. </div>
  223. </div>
  224. </li>
  225. <li class="item">
  226. <a href=""><img src="../static/images13/items/item-21.webp" alt="" /></a>
  227. <div class="desc">
  228. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  229. <div class="price">
  230. <span class="iconfont icon-renminbi">288</span>
  231. <span>123人已购买</span>
  232. </div>
  233. </div>
  234. </li>
  235. <li class="item">
  236. <a href=""><img src="../static/images13/items/item-22.webp" alt="" /></a>
  237. <div class="desc">
  238. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  239. <div class="price">
  240. <span class="iconfont icon-renminbi">288</span>
  241. <span>123人已购买</span>
  242. </div>
  243. </div>
  244. </li>
  245. </ul>
  246. </main>
  247. <!-- *3页脚 -->
  248. <footer>
  249. <a href="" class="iconfont icon-shejiaotubiao-44"></a>
  250. <a href="">
  251. <span class="iconfont icon-gouwuche"></span>
  252. <span>购物车</span>
  253. </a>
  254. <a href="">
  255. <span class="iconfont icon-wode"></span>
  256. <span>我的淘宝</span>
  257. </a>
  258. </footer>
  259. </body>
  260. </html>

对应的index2.css文件:

  1. @import url(public2.css);
  2. @import url(reset2.css);
  3. @import url(../icon_font/font_icon6/iconfont.css);
  4. @import url(main2.css);

对应的reset2.css文件:

  1. *{
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. /* *链接 */
  7. a{
  8. text-decoration: none;
  9. color: #555;
  10. }
  11. /* *列表 */
  12. /* *无小圆点 */
  13. li{
  14. list-style: none;
  15. }
  16. /* *移动端布局方案:rem+vw(这里还是1rem=100px) */
  17. html{
  18. font-size:calc(100vw/3.75);
  19. }
  20. body{
  21. /* *字体大小比原来的0.16rem要小一点 */
  22. font-size: 0.13rem;
  23. color: #333;
  24. /* *在body中居中 */
  25. margin: auto;
  26. /* *为body做一个浅灰色的背景 */
  27. background-color: #f4f4f4;
  28. padding: 0 0.15rem;
  29. /* *滚动条自动隐藏 */
  30. overflow-y: auto;
  31. }
  32. body img{
  33. width: 100%;
  34. }
  35. /* *当屏幕宽度小于320或大于640px时对文字大小作一个限制 */
  36. @media(max-width: 320px){
  37. html{
  38. font-size: 85px;
  39. }
  40. }
  41. @media (min-width: 640px){
  42. html{
  43. font-size: 170px;
  44. }
  45. }

对应的public2.css文件:

  1. header,
  2. footer{
  3. width: 375px;
  4. height: 50px;
  5. background-color: #f4f4f4;
  6. /* background-color: #f4f4f4; */
  7. /* *固定定位 */
  8. position: fixed;
  9. /* *把页眉与页脚的层级往上提一级,使之与main(主体)不在一个层级上,这样就不会互相干涉 */
  10. z-index: 100;
  11. }
  12. header{
  13. top: 0;
  14. left: 0;
  15. right: 0;
  16. }
  17. footer{
  18. bottom: 0;
  19. left: 0;
  20. right: 0;
  21. }
  22. header{
  23. /* *grid布局 */
  24. display: grid;
  25. /* *整个页眉分一行三列 */
  26. grid-template-columns: 0.58rem 1fr 0.33rem;
  27. /* *行高 */
  28. grid-auto-rows: 0.5rem;
  29. /* *每个项目在网格单元中垂直与水平居中 */
  30. place-items: center;
  31. /* *行间隙0,列间隙0.1rem */
  32. gap: 0 0.1rem;
  33. }
  34. header a.logo{
  35. /* *让logo与左面隔开一点 */
  36. padding-left: 0.1rem;
  37. }
  38. /* *搜索框的设置 */
  39. header>a.search{
  40. width: 100%;
  41. border: 2px solid #ff5000;
  42. height: 0.3rem;
  43. border-radius: 0.3rem;
  44. /* *flex布局 */
  45. display: flex;
  46. /* *两端对齐 */
  47. place-content: space-between;
  48. /* *项目在水平方向的交叉轴上居中对齐 */
  49. place-items: center;
  50. }
  51. /* *让搜索框第一个span标签离边框开一点 */
  52. header>a.search span:first-of-type{
  53. padding-left: 0.1rem;
  54. }
  55. /* *搜索框第二个span标签 */
  56. header>a.search span:last-of-type{
  57. background-color: #ff5000;
  58. background: linear-gradient(to left,#ff5000,#ffa000);
  59. color: white;
  60. /* *内边距上下与左右 */
  61. padding: 0.03rem 0.15rem;
  62. /* *右外边距 */
  63. margin-right: 0.01rem;
  64. border-radius: 0.3rem;
  65. }
  66. /* *签到按钮的设置 */
  67. header>a.iconfont{
  68. color: #ff5000;
  69. font-size: larger;
  70. }
  71. /* *页脚 */
  72. footer{
  73. border-top: 1px solid #ccc;
  74. display: grid;
  75. /* *分成3列,每列占3分之一 */
  76. grid-template-columns: repeat(3,1fr);
  77. /* *分散对齐 */
  78. place-content: space-around;
  79. /* *项目在网格单元中垂直与水平居中 */
  80. /* place-items: center; */
  81. font-size: smaller;
  82. }
  83. footer>a{
  84. display: grid;
  85. /* *项目在网格单元中垂直及水平居中 */
  86. place-items: center;
  87. }
  88. footer>a:first-of-type{
  89. color: #ff5000;
  90. font-size: 0.35rem;
  91. }

对应的main2.css文件:

  1. main{
  2. /* *最小高度2000px */
  3. min-height: 2000px;
  4. /* *溢出隐藏 */
  5. overflow: hidden;
  6. /* *由于页眉比主体高一级,故主体被页眉遮挡住,故主体main来个相对定位,并且向下偏移50px */
  7. position: relative;
  8. top: 50px;
  9. /* *防止最下面的商品被页脚遮挡 */
  10. padding-bottom: 0.6rem;
  11. }
  12. /* *主体导航,快速入口,商品列表用到的公共样式 */
  13. main .navs,
  14. main .entry,
  15. /* *商品列表下的各个商品 */
  16. main .list>.item{
  17. background-color: #FFF;
  18. border-radius: 0.1rem;
  19. margin-top: 0.08rem;
  20. }
  21. /* *1导航区 */
  22. main .navs{
  23. /* *grid布局 */
  24. display: grid;
  25. /* *这里分为一行5列,如果是10个项目自然会分成两行,故只能不用添加行数 */
  26. grid-template-columns: repeat(5,1fr);
  27. /* *垂直间隙0,水平间隙0.1rem */
  28. gap: 0 0.1rem;
  29. padding: 0.1rem;
  30. }
  31. /* *导航里边的项目再嵌套一个brid布局,目的是使项目里边的项目能够居中 */
  32. main .navs .item{
  33. display: grid;
  34. place-items: center;
  35. }
  36. /* *2快速入口 */
  37. main .entry{
  38. display: grid;
  39. /* *快速入口分2列 */
  40. grid-template-columns: repeat(2,1tr);
  41. padding: 0.1rem;
  42. }
  43. /* *快速入口里边的项目 */
  44. main .entry .item{
  45. display: grid;
  46. /* *快速入口里边的项目也是分2列 */
  47. grid-template-columns: repeat(2,1tr);
  48. padding: 0.1rem;
  49. }
  50. main .entry .item .title{
  51. /* *跨两列,再来个flex布局,再居中 */
  52. grid-column: span 2;
  53. display: flex;
  54. place-items: center;
  55. }
  56. /* *前两个项目加一条下边框 */
  57. main .entry .item:nth-of-type(-n+2){
  58. border-bottom: 1px solid #dedede;
  59. }
  60. main .entry .item .title>span{
  61. background-color: #ff5000;
  62. color: white;
  63. border-radius: 0.05rem;
  64. font-size: smaller;
  65. padding: 0 0.03rem;
  66. /* *稍微移开一点 */
  67. margin-left: 0.05rem;
  68. }
  69. /* *3.商品列表 */
  70. main .list{
  71. /* *grid布局 */
  72. display: grid;
  73. /* *分两列,每列对半 */
  74. grid-template-columns: repeat(2,1fr);
  75. /* *行间隙0,列间隙0.1rem */
  76. gap: 0 0.1rem;
  77. }
  78. main .list .item img{
  79. /* *边框圆角设计(上右下左) */
  80. border-radius: 0.1rem 0.1rem 0 0;
  81. }
  82. /* *商品描述 */
  83. main .list .item .desc{
  84. padding: 0.1rem;
  85. font-size: smaller;
  86. }
  87. /* *价格 */
  88. main .list .item .price .iconfont{
  89. color: #f50;
  90. font-size: smaller;
  91. }
  92. main .list .item .price span:last-of-type{
  93. color: #bbb;
  94. font-size: smaller;
  95. }

浏览器上的效果图如下:

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