博客列表 >仿京东移动端首页参考

仿京东移动端首页参考

JOAblog
JOAblog原创
2021年07月11日 17:44:10587浏览

仿京东移动端首页

效果图示:

html代码实现

  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="/img/font_icon/iconfont.css" />
  8. <link rel="stylesheet" href="/css/index.css" />
  9. <title>多快好省就上京东购物</title>
  10. </head>
  11. <body>
  12. <!-- 页眉 -->
  13. <div class="head">
  14. <!-- 顶部左侧图标按钮 -->
  15. <div class="caidan iconfont icon-gengduo"></div>
  16. <!-- 中部搜索 -->
  17. <div class="sousuo">
  18. <!-- 文字LOGOJD -->
  19. <p>JD</p>
  20. <!-- 搜索图标 -->
  21. <div class="sousuotubiao iconfont icon-sousuo"></div>
  22. <!-- 搜索输入框 -->
  23. <input
  24. type="text"
  25. name="sousuo"
  26. id="sousuo"
  27. placeholder="输入想要购买的商品"
  28. />
  29. </div>
  30. <!-- 顶部右侧登录 -->
  31. <div class="login"><span>登录</span></div>
  32. </div>
  33. <!-- 主体 -->
  34. <div class="main">
  35. <!-- banner -->
  36. <div class="banner"><img src="/img/banner.png" alt="" /></div>
  37. <!-- 主体菜单 -->
  38. <div class="maincd">
  39. <a href=""
  40. ><img src="/img/jdicon/1.png" alt="" /><span>京东超市</span></a
  41. >
  42. <a href=""
  43. ><img src="/img/jdicon/2.png" alt="" /><span>数码电器</span></a
  44. >
  45. <a href=""
  46. ><img src="/img/jdicon/3.png" alt="" /><span>京东服饰</span></a
  47. ><a href=""
  48. ><img src="/img/jdicon/4.png" alt="" /><span>京东生鲜</span></a
  49. >
  50. <a href=""
  51. ><img src="/img/jdicon/5.png" alt="" /><span>京东到家</span></a
  52. >
  53. <a href=""
  54. ><img src="/img/jdicon/1.png" alt="" /><span>充值缴费</span></a
  55. ><a href=""
  56. ><img src="/img/jdicon/2.png" alt="" /><span>9.9元拼</span></a
  57. >
  58. <a href=""><img src="/img/jdicon/4.png" alt="" /><span>领券</span></a>
  59. <a href=""><img src="/img/jdicon/3.png" alt="" /><span>领津贴</span></a
  60. ><a href=""
  61. ><img src="/img/jdicon/2.png" alt="" /><span>PLUS会员</span></a
  62. >
  63. </div>
  64. <!-- 秒杀 -->
  65. <div class="miaosha">
  66. <div class="miaoshatop">
  67. <a href="">
  68. <div><p>京东秒杀</p></div>
  69. <div>14点场</div>
  70. <div>
  71. <div>00</div>
  72. <span>:</span>
  73. <div>13</div>
  74. <span>:</span>
  75. <div>22</div>
  76. </div>
  77. </a>
  78. <a href="">更多秒杀</a>
  79. </div>
  80. <div class="miaoshamain">
  81. <ur class="miaoshaul">
  82. <li class="miaoshali">
  83. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  84. <div>
  85. <span><em></em> 11</span
  86. ><span
  87. ><em></em> 22
  88. <hr
  89. /></span>
  90. </div>
  91. </li>
  92. <li class="miaoshali">
  93. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  94. <div>
  95. <span><em></em> 33</span
  96. ><span
  97. ><em></em> 44
  98. <hr
  99. /></span>
  100. </div>
  101. </li>
  102. <li class="miaoshali">
  103. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  104. <div>
  105. <span><em></em> 55</span
  106. ><span
  107. ><em></em> 66
  108. <hr
  109. /></span>
  110. </div>
  111. </li>
  112. <li class="miaoshali">
  113. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  114. <div>
  115. <span><em></em> 77</span
  116. ><span
  117. ><em></em> 88
  118. <hr
  119. /></span>
  120. </div>
  121. </li>
  122. <li class="miaoshali">
  123. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  124. <div>
  125. <span> <em></em> 99</span
  126. ><span
  127. ><em></em> 110
  128. <hr
  129. /></span>
  130. </div>
  131. </li>
  132. <li class="miaoshali">
  133. <div><img src="/img/jdicon/1.jpg" alt="" /></div>
  134. <div>
  135. <span><em></em> 120</span
  136. ><span
  137. ><em></em> 130
  138. <hr
  139. /></span>
  140. </div>
  141. </li>
  142. </ur>
  143. </div>
  144. </div>
  145. <!-- 商品区 -->
  146. <div class="sp">
  147. <ul class="spul">
  148. <li class="spli">
  149. <div class="spimg">
  150. <img src="/img/jdicon/2.jpg" alt="" />
  151. </div>
  152. <div class="sptext">
  153. BOTTLED
  154. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  155. </div>
  156. <div class="splook">
  157. <a href="" class="spjg">¥159</a>
  158. <a href="" class="spxs">看相似</a>
  159. </div>
  160. </li>
  161. <li class="spli">
  162. <div class="spimg">
  163. <img src="/img/jdicon/2.jpg" alt="" />
  164. </div>
  165. <div class="sptext">
  166. BOTTLED
  167. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  168. </div>
  169. <div class="splook">
  170. <a href="" class="spjg">¥159</a>
  171. <a href="" class="spxs">看相似</a>
  172. </div>
  173. </li>
  174. <li class="spli">
  175. <div class="spimg">
  176. <img src="/img/jdicon/2.jpg" alt="" />
  177. </div>
  178. <div class="sptext">
  179. BOTTLED
  180. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  181. </div>
  182. <div class="splook">
  183. <a href="" class="spjg">¥159</a>
  184. <a href="" class="spxs">看相似</a>
  185. </div>
  186. </li>
  187. <li class="spli">
  188. <div class="spimg">
  189. <img src="/img/jdicon/2.jpg" alt="" />
  190. </div>
  191. <div class="sptext">
  192. BOTTLED
  193. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  194. </div>
  195. <div class="splook">
  196. <a href="" class="spjg">¥159</a>
  197. <a href="" class="spxs">看相似</a>
  198. </div>
  199. </li>
  200. <li class="spli">
  201. <div class="spimg">
  202. <img src="/img/jdicon/2.jpg" alt="" />
  203. </div>
  204. <div class="sptext">
  205. BOTTLED
  206. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  207. </div>
  208. <div class="splook">
  209. <a href="" class="spjg">¥159</a>
  210. <a href="" class="spxs">看相似</a>
  211. </div>
  212. </li>
  213. <li class="spli">
  214. <div class="spimg">
  215. <img src="/img/jdicon/2.jpg" alt="" />
  216. </div>
  217. <div class="sptext">
  218. BOTTLED
  219. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  220. </div>
  221. <div class="splook">
  222. <a href="" class="spjg">¥159</a>
  223. <a href="" class="spxs">看相似</a>
  224. </div>
  225. </li>
  226. <li class="spli">
  227. <div class="spimg">
  228. <img src="/img/jdicon/2.jpg" alt="" />
  229. </div>
  230. <div class="sptext">
  231. BOTTLED
  232. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  233. </div>
  234. <div class="splook">
  235. <a href="" class="spjg">¥159</a>
  236. <a href="" class="spxs">看相似</a>
  237. </div>
  238. </li>
  239. <li class="spli">
  240. <div class="spimg">
  241. <img src="/img/jdicon/2.jpg" alt="" />
  242. </div>
  243. <div class="sptext">
  244. BOTTLED
  245. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  246. </div>
  247. <div class="splook">
  248. <a href="" class="spjg">¥159</a>
  249. <a href="" class="spxs">看相似</a>
  250. </div>
  251. </li>
  252. <li class="spli">
  253. <div class="spimg">
  254. <img src="/img/jdicon/2.jpg" alt="" />
  255. </div>
  256. <div class="sptext">
  257. BOTTLED
  258. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  259. </div>
  260. <div class="splook">
  261. <a href="" class="spjg">¥159</a>
  262. <a href="" class="spxs">看相似</a>
  263. </div>
  264. </li>
  265. <li class="spli">
  266. <div class="spimg">
  267. <img src="/img/jdicon/2.jpg" alt="" />
  268. </div>
  269. <div class="sptext">
  270. BOTTLED
  271. JOY运动水壶健身水杯大容量承认便携户外便携户外便携户外便携户外便携户外...
  272. </div>
  273. <div class="splook">
  274. <a href="" class="spjg">¥159</a>
  275. <a href="" class="spxs">看相似</a>
  276. </div>
  277. </li>
  278. </ul>
  279. </div>
  280. </div>
  281. <!-- 页脚 -->
  282. <div class="footer">
  283. <ur>
  284. <li class="iconfont icon-jingdong">
  285. <span>首页</span>
  286. </li>
  287. <li class="iconfont icon-sort"><span>分类</span></li>
  288. <li class="iconfont icon-niu"><span>京喜</span></li>
  289. <li class="iconfont icon-gwc"><span>购物车</span></li>
  290. <li class="iconfont icon-denglu"><span>未登录</span></li>
  291. </ur>
  292. </div>
  293. </body>
  294. </html>

index.css代码:

  1. @import url(/css/head.css);
  2. @import url(/css/footer.css);
  3. @import url(/css/main.css);
  4. *{
  5. padding: 0;margin: 0;box-sizing: border-box;
  6. }
  7. :root{
  8. font-size: 10px;
  9. }
  10. body{
  11. font-size: 1.6rem;
  12. }

head.css代码:

  1. .head {
  2. background-color: #c82519;
  3. height: 4.5rem;
  4. color: white;
  5. position: fixed;
  6. top: 0;
  7. left: 0;
  8. right: 0;
  9. display: flex;
  10. z-index: 9;
  11. }
  12. .head .caidan {
  13. font-size: 2rem;
  14. text-align: center;
  15. flex: 1;
  16. position: relative;
  17. top: 1rem;
  18. }
  19. .head .sousuo {
  20. flex: 6;
  21. display: flex;
  22. background-color: white;
  23. color: #c82519;
  24. font-size: 2rem;
  25. justify-content: space-evenly;
  26. border-radius: 2.5rem;
  27. height: 3rem;
  28. position: relative;
  29. top: 0.8rem;
  30. align-items: center;
  31. }
  32. .head .sousuo > p {
  33. font-weight: bolder;
  34. color: #e93b3d;
  35. }
  36. .head .sousuo .sousuotubiao {
  37. font-size: 2rem;
  38. color: #dbdbdb;
  39. border-left: 1px solid #dddddd;
  40. padding-left: 1rem;
  41. }
  42. .head .sousuo > input {
  43. border: none;
  44. outline: medium;
  45. }
  46. .head .login {
  47. font-size: 1.5rem;
  48. text-align: center;
  49. flex: 1;
  50. position: relative;
  51. top: 1rem;
  52. }
  1. li{
  2. list-style: none;
  3. }
  4. .footer{
  5. height: 5rem;
  6. background-color: #FFFFFF;
  7. position: fixed;
  8. bottom: 0;
  9. right: 0;
  10. left: 0;
  11. box-shadow: 0 0 5px #E2DFDF;
  12. z-index: 1;
  13. }
  14. .footer ur{
  15. display: flex;
  16. justify-content:space-around;
  17. position:relative;
  18. top: 1rem;
  19. }
  20. .footer ur li{
  21. flex-direction: column;
  22. display: flex;
  23. align-items: center;
  24. font-size: 2rem;
  25. color: #8B8B8B;
  26. position:relative;
  27. bottom: 1rem;
  28. padding-top: 6px;
  29. }
  30. .footer ur li:hover{
  31. color: red;
  32. }
  33. .footer ur li>span{
  34. font-size: 0.5rem;
  35. }

main.css代码:

  1. @import url(/css/maincd.css);
  2. @import url(/css/sp.css);
  3. .main {
  4. z-index: -1;
  5. margin-top: 4.5rem;
  6. margin-bottom: 5rem;
  7. background-color: #f6f6f6;
  8. }
  9. .main .banner {
  10. background-color: #c82519;
  11. height: 10rem;
  12. border-bottom-left-radius: 5rem;
  13. border-bottom-right-radius: 5rem;
  14. }
  15. .main .banner > img {
  16. height: 14rem;
  17. width: 35.5rem;
  18. max-width: 40rem;
  19. border-radius: 1rem;
  20. position: absolute;
  21. left: 1rem;
  22. top: 4.5rem;
  23. }

maincd.css代码:

  1. .main .maincd {
  2. margin-top: 5rem;
  3. display: flex;
  4. flex-wrap: wrap;
  5. justify-content: space-around;
  6. margin-bottom: 2rem;
  7. }
  8. .main .maincd > a {
  9. display: flex;
  10. flex-direction: column;
  11. text-decoration: none;
  12. color: #7e7e7e;
  13. align-items: center;
  14. margin-bottom: 1rem;
  15. width: 6.6rem;
  16. }
  17. .main .maincd > a > span {
  18. font-size: 1.2rem;
  19. margin-top: 0.6rem;
  20. }
  21. .main .maincd > a > img {
  22. width: 4rem;
  23. height: 4rem;
  24. text-align: center;
  25. }
  26. .miaosha {
  27. background-color: #fff;
  28. position: relative;
  29. left: 0;
  30. right: 0;
  31. height: 13.5rem;
  32. margin-left: 1rem;
  33. margin-right: 1rem;
  34. border-radius: 1rem;
  35. margin-bottom: 1rem;
  36. display: flex;
  37. flex-direction: column;
  38. /* text-decoration: none; */
  39. }
  40. .miaosha .miaoshatop {
  41. display: flex;
  42. justify-content: space-between;
  43. }
  44. .miaosha .miaoshatop > a {
  45. text-decoration: none;
  46. /* color: #222222; */
  47. }
  48. .miaosha .miaoshatop > a:first-of-type {
  49. color: #222;
  50. flex: 2;
  51. margin-top: 1rem;
  52. margin-left: 1rem;
  53. font-size: 1.4rem;
  54. display: flex;
  55. justify-content: space-between;
  56. }
  57. .miaosha .miaoshatop > a:last-of-type {
  58. color: #f23121;
  59. flex: 2;
  60. margin-right: 1rem;
  61. margin-top: 1rem;
  62. font-size: 1.2rem;
  63. display: flex;
  64. justify-content: flex-end;
  65. }
  66. .miaosha .miaoshatop > a:first-of-type > div:first-of-type + div {
  67. color: red;
  68. }
  69. .miaosha .miaoshatop > a:first-of-type > div:first-of-type + div + div {
  70. display: flex;
  71. justify-content: flex-end;
  72. }
  73. .miaosha .miaoshatop > a:first-of-type > div:first-of-type + div + div > span {
  74. color: red;
  75. }
  76. .miaosha .miaoshatop > a:first-of-type > div:first-of-type + div + div > div {
  77. background-color: red;
  78. color: white;
  79. border-radius: 0.5rem;
  80. width: auto;
  81. }
  82. .miaoshamain .miaoshaul {
  83. display: flex;
  84. justify-content: space-between;
  85. text-align: center;
  86. }
  87. .miaoshamain .miaoshaul .miaoshali {
  88. width: 5.7rem;
  89. }
  90. .miaoshamain .miaoshaul .miaoshali > div > img {
  91. height: 5.5rem;
  92. width: 5.5rem;
  93. margin-top: 1rem;
  94. /* margin-bottom: 1rem; */
  95. }
  96. .miaoshamain .miaoshaul .miaoshali > div:last-of-type {
  97. display: flex;
  98. flex-direction: column;
  99. font-size: 1rem;
  100. }
  101. .miaoshamain .miaoshaul .miaoshali > div:last-of-type > span:first-of-type {
  102. color: red;
  103. }
  104. .miaoshamain .miaoshaul .miaoshali > div:last-of-type > span:last-of-type {
  105. color: #999;
  106. position: relative;
  107. }
  108. .miaoshamain .miaoshaul .miaoshali > div:last-of-type > span:last-of-type > hr {
  109. width: 3rem;
  110. position: absolute;
  111. top: 1rem;
  112. left: 2rem;
  113. }

sp.css代码:

  1. .sp .spul {
  2. display: flex;
  3. flex-wrap: wrap;
  4. }
  5. .sp .spul .spli {
  6. width: 17rem;
  7. min-height: 26rem;
  8. background-color: #fff;
  9. border-radius: 1rem;
  10. margin-left: 1rem;
  11. margin-top: 1rem;
  12. }
  13. .sp .spul .spli .spimg > img {
  14. width: 17rem;
  15. border-radius: 1rem 1rem 0 0;
  16. }
  17. .sp .spul .spli .sptext {
  18. font-size: 1.2rem;
  19. margin-left: 0.5rem;
  20. margin-right: 0.5rem;
  21. height: 3rem;
  22. width: auto;
  23. -webkit-line-clamp: 2;
  24. display: -webkit-box;
  25. overflow: hidden;
  26. -webkit-box-orient: vertical;
  27. text-overflow: ellipsis;
  28. }
  29. .sp .spul .spli .splook {
  30. display: flex;
  31. margin-left: 0.5rem;
  32. margin-top: 1rem;
  33. justify-content: space-between;
  34. }
  35. .sp .spul .spli .splook a {
  36. text-decoration: none;
  37. }
  38. .sp .spul .spli .splook a:first-of-type {
  39. color: red;
  40. }
  41. .sp .spul .spli .splook a:last-of-type {
  42. background-color: #f0f2f5;
  43. color: #808080;
  44. border-radius: 1rem 0rem 0 1rem;
  45. width: 4.5rem;
  46. font-size: 1rem;
  47. text-align: right;
  48. padding: 0.2rem;
  49. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议