博客列表 >尝试仿作“京东商城”手机网站

尝试仿作“京东商城”手机网站

华宥为
华宥为原创
2021年01月03日 20:06:03684浏览

尝试仿作“京东商城”手机网站

html部分

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>首页</title>
  7. <!-- 字体图标 -->
  8. <link rel="stylesheet" href="/1223/static/css/iconfont.css" />
  9. <link rel="stylesheet" href="/1223/static/css/icon-font/iconfont.css" />
  10. <!-- 首页 -->
  11. <link rel="stylesheet" href="/1223/static/css/index.css" />
  12. <!-- 页眉区 -->
  13. <link rel="stylesheet" href="/1223/static/css/header.css" />
  14. <!-- 导航 -->
  15. <link rel="stylesheet" href="/1223/static/css/nav.css" />
  16. <!-- 秒杀 -->
  17. <link rel="stylesheet" href="/1223/static/css/ms.css" />
  18. <!-- 猜你喜欢 -->
  19. <link rel="stylesheet" href="/1223/static/css/tj.css" />
  20. <!-- 页脚 -->
  21. <link rel="stylesheet" href="/1223/static/css/footer.css" />
  22. </head>
  23. <body>
  24. <!-- 页眉 -->
  25. <div class="header">
  26. <!-- 字体图标 -->
  27. <div class="menu iconfont icon-V"></div>
  28. <!-- 搜索框 -->
  29. <div class="search">
  30. <div class="logo">JD</div>
  31. <div class="zoom iconfont icon-viewlarger"></div>
  32. <input class="words" type="text" value="蓝牙鼠标" />
  33. </div>
  34. <!-- 登录按钮 -->
  35. <a href="" class="login">登录</a>
  36. </div>
  37. <!-- 主体 -->
  38. <div class="main">
  39. <div>
  40. <img class="pic-1" src="/1223/static/images/bg/banner.jpg" alt="" />
  41. </div>
  42. <!-- 主导航区 -->
  43. <ul class="nav">
  44. <li>
  45. <a href=""
  46. ><img src="/1223/static/images/shangpin (1).png" alt=""
  47. /></a>
  48. <a href="">京东超市</a>
  49. </li>
  50. <li>
  51. <a href=""
  52. ><img src="/1223/static/images/shangpin (2).png" alt=""
  53. /></a>
  54. <a href="">数码超市</a>
  55. </li>
  56. <li>
  57. <a href=""
  58. ><img src="/1223/static/images/shangpin (3).png" alt=""
  59. /></a>
  60. <a href="">京东服饰</a>
  61. </li>
  62. <li>
  63. <a href=""
  64. ><img src="/1223/static/images/shangpin (4).png" alt=""
  65. /></a>
  66. <a href="">京东生鲜</a>
  67. </li>
  68. <li>
  69. <a href=""
  70. ><img src="/1223/static/images/shangpin (5).png" alt=""
  71. /></a>
  72. <a href="">充值缴费</a>
  73. </li>
  74. <li>
  75. <a href=""
  76. ><img src="/1223/static/images/shangpin (6).png" alt=""
  77. /></a>
  78. <a href="">9.9元拼</a>
  79. </li>
  80. <li>
  81. <a href=""
  82. ><img src="/1223/static/images/shangpin (7).png" alt=""
  83. /></a>
  84. <a href="">领券</a>
  85. </li>
  86. <li>
  87. <a href=""
  88. ><img src="/1223/static/images/shangpin (8).png" alt=""
  89. /></a>
  90. <a href="">借钱</a>
  91. </li>
  92. <li>
  93. <a href=""
  94. ><img src="/1223/static/images/shangpin (9).png" alt=""
  95. /></a>
  96. <a href="">京东到家</a>
  97. </li>
  98. <li>
  99. <a href=""
  100. ><img src="/1223/static/images/shangpin (10).png" alt=""
  101. /></a>
  102. <a href="">PLUS会员</a>
  103. </li>
  104. </ul>
  105. <!-- 秒杀区 -->
  106. <div class="ms">
  107. <div class="ms-top">
  108. <div class="left">
  109. <div class="title">京东秒杀</div>
  110. <div class="notice">
  111. <div class="tips">22点专场</div>
  112. <div class="time">01:11:22</div>
  113. </div>
  114. </div>
  115. <div class="right">更多秒杀</div>
  116. </div>
  117. <div class="ms-body">
  118. <li class="item">
  119. <a href=""><img src="/1223/static/images/ms- (1).png" alt="" /></a>
  120. <div class="iconfont icon-rmb">338</div>
  121. <div class="iconfont icon-rmb">558</div>
  122. </li>
  123. <li class="item">
  124. <a href=""><img src="/1223/static/images/ms- (2).png" alt="" /></a>
  125. <div class="iconfont icon-rmb">738</div>
  126. <div class="iconfont icon-rmb">858</div>
  127. </li>
  128. <li class="item">
  129. <a href=""><img src="/1223/static/images/ms- (3).png" alt="" /></a>
  130. <div class="iconfont icon-rmb">6738</div>
  131. <div class="iconfont icon-rmb">8858</div>
  132. </li>
  133. <li class="item">
  134. <a href=""><img src="/1223/static/images/ms- (4).png" alt="" /></a>
  135. <div class="iconfont icon-rmb">4568</div>
  136. <div class="iconfont icon-rmb">5588</div>
  137. </li>
  138. <li class="item">
  139. <a href=""><img src="/1223/static/images/ms- (5).png" alt="" /></a>
  140. <div class="iconfont icon-rmb">1338</div>
  141. <div class="iconfont icon-rmb">2558</div>
  142. </li>
  143. </div>
  144. </div>
  145. <!-- 猜你喜欢 -->
  146. <h3 class="title">猜你喜欢</h3>
  147. <ul class="tj">
  148. <li class="item">
  149. <a href=""><img src="/1223/static/images/sp/sp-1.webp" alt="" /></a>
  150. <p>
  151. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  152. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  153. </p>
  154. <div class="price">
  155. <div class="iconfont icon-rmb">203</div>
  156. <div>看相似</div>
  157. </div>
  158. </li>
  159. <li class="item">
  160. <a href=""><img src="/1223/static/images/sp/sp-2.webp" alt="" /></a>
  161. <p>
  162. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  163. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  164. </p>
  165. <div class="price">
  166. <div class="iconfont icon-rmb">203</div>
  167. <div>看相似</div>
  168. </div>
  169. </li>
  170. <li class="item">
  171. <a href=""><img src="/1223/static/images/sp/sp-3.webp" alt="" /></a>
  172. <p>
  173. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  174. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  175. </p>
  176. <div class="price">
  177. <div class="iconfont icon-rmb">203</div>
  178. <div>看相似</div>
  179. </div>
  180. </li>
  181. <li class="item">
  182. <a href=""><img src="/1223/static/images/sp/sp-4.webp" alt="" /></a>
  183. <p>
  184. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  185. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  186. </p>
  187. <div class="price">
  188. <div class="iconfont icon-rmb">203</div>
  189. <div>看相似</div>
  190. </div>
  191. </li>
  192. <li class="item">
  193. <a href=""><img src="/1223/static/images/sp/sp-5.webp" alt="" /></a>
  194. <p>
  195. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  196. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  197. </p>
  198. <div class="price">
  199. <div class="iconfont icon-rmb">203</div>
  200. <div>看相似</div>
  201. </div>
  202. </li>
  203. <li class="item">
  204. <a href=""><img src="/1223/static/images/sp/sp-6.webp" alt="" /></a>
  205. <p>
  206. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  207. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  208. </p>
  209. <div class="price">
  210. <div class="iconfont icon-rmb">203</div>
  211. <div>看相似</div>
  212. </div>
  213. </li>
  214. <li class="item">
  215. <a href=""><img src="/1223/static/images/sp/sp-7.webp" alt="" /></a>
  216. <p>
  217. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  218. 2、完成网站所有静态页面布局;重点:弹性布局与网格布局;
  219. </p>
  220. <div class="price">
  221. <div class="iconfont icon-rmb">203</div>
  222. <div>看相似</div>
  223. </div>
  224. </li>
  225. <li class="item">
  226. <a href=""><img src="/1223/static/images/sp/sp-8.webp" alt="" /></a>
  227. <p>
  228. php中文网第十四期前端开发部分学习目标:1、HTML5+CSS3基础知识与实战;
  229. </p>
  230. <div class="price">
  231. <div class="iconfont icon-rmb">203</div>
  232. <div>看相似</div>
  233. </div>
  234. </li>
  235. </ul>
  236. </div>
  237. <!-- 页脚 -->
  238. <div class="footer">
  239. <div>
  240. <div class="iconfont icon-home"></div>
  241. <span>主页</span>
  242. </div>
  243. <div>
  244. <div class="iconfont icon-layers"></div>
  245. <span>分类</span>
  246. </div>
  247. <div>
  248. <div class="iconfont icon-kehuguanli"></div>
  249. <span>惊喜</span>
  250. </div>
  251. <div>
  252. <div class="iconfont icon-shopping-cart"></div>
  253. <span>购物车</span>
  254. </div>
  255. <div>
  256. <div class="iconfont icon-user"></div>
  257. <span>未登录</span>
  258. </div>
  259. </div>
  260. </body>
  261. </html>

css部分

  • index.css
  1. @import "/1223/static/css/reset.css";
  2. /* 页眉 */
  3. .header {
  4. background-color: #e43130;
  5. color: white;
  6. height: 3.5rem;
  7. font-size: 1.4rem;
  8. /* 固定定位 */
  9. position: fixed;
  10. top: 0;
  11. left: 0;
  12. right: 0;
  13. z-index: 100;
  14. }
  15. /* 页脚 */
  16. .footer {
  17. color: #666;
  18. background-color: #fafafa;
  19. box-shadow: 0 0 3px #999;
  20. height: 4.4rem;
  21. font-size: 1.4rem;
  22. /* 固定定位 */
  23. position: fixed;
  24. bottom: 0;
  25. left: 0;
  26. right: 0;
  27. z-index: 100;
  28. }
  29. /* 主体 */
  30. .main {
  31. /* 绝对定位 */
  32. position: absolute;
  33. top: 4.4rem;
  34. bottom: 4.4rem;
  35. left: 0;
  36. right: 0;
  37. font-size: 1.4rem;
  38. /* height: 100rem; */
  39. /* background-color: yellow; */
  40. }
  • reset.css
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. li {
  7. list-style: none;
  8. }
  9. a {
  10. columns: #7b7b7b;
  11. text-decoration: none;
  12. }
  13. body {
  14. background-color: #f6f6f6;
  15. }
  16. html {
  17. font-size: 10px;
  18. }
  19. /* 媒体查询 */
  20. @media screen and (min-width: 480px) {
  21. html {
  22. font-size: 12px;
  23. }
  24. }
  25. @media screen and (min-width: 640px) {
  26. html {
  27. font-size: 14px;
  28. }
  29. }
  30. @media screen and (min-width: 720px) {
  31. html {
  32. font-size: 16px;
  33. }
  34. }
  • header.css
  1. .header {
  2. display: flex;
  3. align-items: center;
  4. }
  5. /* 页眉中三个部分的比例 1:6:1 */
  6. .header .login {
  7. flex: 1;
  8. color: #fff;
  9. text-align: center;
  10. }
  11. .header .menu {
  12. flex: 1;
  13. text-align: center;
  14. font-size: 2rem;
  15. }
  16. .header .search {
  17. flex: 6;
  18. padding: 0.3rem 0.5rem;
  19. background-color: #fff;
  20. border-radius: 3rem;
  21. display: flex;
  22. }
  23. .header .search .logo {
  24. color: #e34130;
  25. flex: 0 1 3rem;
  26. font-size: 1.5rem;
  27. /* padding: 0 0.2rem; */
  28. /* 水平垂直居中 */
  29. text-align: center;
  30. /* align-items: center; */
  31. line-height: 2rem;
  32. }
  33. .header .search .zoom {
  34. color: #cccccc;
  35. flex: 0 1 4 #ccc;
  36. font-size: 2rem;
  37. /* padding: 0 0.2rem; */
  38. border-left: 1px solid;
  39. /* 水平垂直居中 */
  40. text-align: center;
  41. /* align-items: center; */
  42. line-height: 2rem;
  43. }
  44. /* 搜索文本框 */
  45. .header .search .words {
  46. flex: auto;
  47. border: none;
  48. outline: none;
  49. font-size: 1.2rem;
  50. color: #aaaaaa;
  51. }
  • footer.css
  1. .footer {
  2. display: flex;
  3. justify-content: space-around;
  4. padding-top: 0.5rem;
  5. }
  6. .footer > div {
  7. display: flex;
  8. flex-flow: column nowrap;
  9. align-items: center;
  10. }
  11. .footer > div > .iconfont {
  12. font-size: 2rem;
  13. }
  14. .footer > div > span {
  15. font-size: 1rem;
  16. }
  • nav.css
  1. .main .nav {
  2. padding: 1rem;
  3. display: flex;
  4. flex-flow: row wrap;
  5. justify-content: space-between;
  6. }
  7. .main .nav img {
  8. height: 4rem;
  9. width: 4rem;
  10. }
  11. .main .nav li {
  12. flex: 1 1 20%;
  13. display: flex;
  14. flex-flow: column nowrap;
  15. align-items: center;
  16. }
  17. .main a {
  18. font-size: 1rem;
  19. }
  20. .main .pic-1 {
  21. width: 100%;
  22. border-radius: 10rem;
  23. padding: 0 1rem;
  24. }
  • ms.css
  1. /* 秒杀 */
  2. .main .ms {
  3. background-color: rgb(230, 227, 224);
  4. padding: 1rem;
  5. margin: 1rem 0;
  6. border-radius: 2rem;
  7. }
  8. .main .ms .ms-top {
  9. font-size: 1.3rem;
  10. height: 3rem;
  11. display: flex;
  12. justify-content: space-between;
  13. }
  14. .main .ms .ms-top .left {
  15. display: flex;
  16. }
  17. .main .ms .ms-top .left .notice {
  18. font-size: 1.1rem;
  19. height: 2rem;
  20. border: 1px solid #e43130;
  21. border-radius: 2rem;
  22. margin-left: 1rem;
  23. display: flex;
  24. justify-content: center;
  25. align-items: center;
  26. }
  27. .main .ms .ms-top .left .notice .tips {
  28. background-color: #e43130;
  29. color: #fff;
  30. border-radius: 2rem;
  31. padding: 0.3rem 0.5rem;
  32. }
  33. .main .ms .ms-top .left .notice .time {
  34. padding: 0.3rem 0.5rem;
  35. }
  36. .main .ms .ms-top .right {
  37. color: #e43130;
  38. }
  39. /* 主体区 */
  40. .main .ms .ms-body {
  41. background-color: #fff;
  42. border-radius: 1rem;
  43. display: flex;
  44. justify-content: space-between;
  45. /* justify-content: center; */
  46. }
  47. .main .ms .ms-body img {
  48. height: 7rem;
  49. width: 7rem;
  50. }
  51. .main .ms .ms-body .item div:first-of-type {
  52. color: #e43130;
  53. font-weight: bolder;
  54. }
  55. .main .ms .ms-body .item div:last-of-type {
  56. color: #666;
  57. text-decoration: line-through;
  58. text-decoration-color: #666;
  59. }
  • tj.css
  1. .main .title {
  2. height: 4rem;
  3. color: #555555;
  4. font-weight: 550;
  5. text-align: center;
  6. }
  7. .main .tj {
  8. font-size: 1rem;
  9. display: flex;
  10. flex-wrap: wrap;
  11. }
  12. .main .tj .item {
  13. flex: 0 1 calc(50% - 2rem);
  14. background-color: azure;
  15. overflow: hidden;
  16. display: flex;
  17. flex-flow: column nowrap;
  18. margin-left: 1rem;
  19. margin-bottom: 1rem;
  20. padding-bottom: 1rem;
  21. border-radius: 1rem;
  22. }
  23. .main .tj .item img {
  24. width: 100%;
  25. height: 100%;
  26. }
  27. .main .tj .item {
  28. padding: 1rem;
  29. }
  30. .main .tj .item .price {
  31. display: flex;
  32. justify-content: space-between;
  33. }
  34. .main .tj .item .price div:first-of-type {
  35. color: brown;
  36. }
  37. .main .tj .item .price div:last-of-type {
  38. color: rgb(78, 70, 70);
  39. background-color: #f6f6f6;
  40. border-radius: 1rem;
  41. padding: 0.2rem 1rem;
  42. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议