欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

仿京东商城移动端网页

程序员文章站 2022-04-28 22:32:40
...

HTML代码

  1. <!DOCTYPE html>
  2. <html lang="Zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" href="css/styles.css">
  7. <title>仿京东商城移动端网页</title>
  8. </head>
  9. <body>
  10. <header>
  11. <div class="tubiao iconfont icon-liebiao2"></div>
  12. <div class="search">
  13. <div class="logo">JD</div>
  14. <div class="search_icon iconfont icon-sousuo"></div>
  15. <input class="search_input" type="text" value="OPPO手机">
  16. </div>
  17. <a href="" class="login">登录</a>
  18. </header>
  19. <main>
  20. <div class="banner">
  21. <div class="banner_bg"></div>
  22. <img src="images/banner.jpg">
  23. </div>
  24. <div class="nav">
  25. <li>
  26. <a href=""><img src="images/1.png" alt=""></a>
  27. <a href="">京东国际</a>
  28. </li>
  29. <li>
  30. <a href=""><img src="images/2.png" alt=""></a>
  31. <a href="">京东拍卖</a>
  32. </li>
  33. <li>
  34. <a href=""><img src="images/3.png" alt=""></a>
  35. <a href="">唯品会</a>
  36. </li>
  37. <li>
  38. <a href=""><img src="images/4.png" alt=""></a>
  39. <a href="">玩3C</a>
  40. </li>
  41. <li>
  42. <a href=""><img src="images/5.png" alt=""></a>
  43. <a href="">沃尔玛</a>
  44. </li>
  45. <li>
  46. <a href=""><img src="images/6.png" alt=""></a>
  47. <a href="">美妆馆</a>
  48. </li>
  49. <li>
  50. <a href=""><img src="images/7.png" alt=""></a>
  51. <a href="">京东旅行</a>
  52. </li>
  53. <li>
  54. <a href=""><img src="images/8.png" alt=""></a>
  55. <a href="">拍拍二手</a>
  56. </li>
  57. <li>
  58. <a href=""><img src="images/9.png" alt=""></a>
  59. <a href="">物流查询</a>
  60. </li>
  61. <li>
  62. <a href=""><img src="images/10.png" alt=""></a>
  63. <a href="">全部</a>
  64. </li>
  65. </div>
  66. <div class="chaoliu">
  67. <h2 class="chaoliu_title">来电好货 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 国潮风尚</h2>
  68. <div class="chaoliu_sp">
  69. <li>
  70. <a href="">正品直邮</a>
  71. <a href=""><img src="images/chao1.png" alt=""></a>
  72. </li>
  73. <li>
  74. <a href="">3C大放价</a>
  75. <a href=""><img src="images/chao2.png" alt=""></a>
  76. </li>
  77. <li>
  78. <a href="">国货正当时</a>
  79. <a href=""><img src="images/chao3.png" alt=""></a>
  80. </li>
  81. <li>
  82. <a href="">都是你爱的</a>
  83. <a href=""><img src="images/chao4.jpg" alt=""></a>
  84. </li>
  85. </div>
  86. </div>
  87. <h2 class="title">猜你喜欢</h2>
  88. <div class="hot">
  89. <li class="item">
  90. <a href=""><img src="images/1.webp" alt=""></a>
  91. <p>义婕秋冬装2020新款修身网纱针织连衣裙件套毛衣女套装裙A18-6507 黑色 S</p>
  92. <div class="price">
  93. <div class="iconfont icon-rmb">130</div>
  94. <div>看相似</div>
  95. </div>
  96. </li>
  97. <li class="item">
  98. <a href=""><img src="images/2.webp" alt=""></a>
  99. <p>羽绒服女中长款女士外套2020新品秋冬绒加厚 17米白色 L(建议115斤-125斤)</p>
  100. <div class="price">
  101. <div class="iconfont icon-rmb">598 <span>满减</span></div>
  102. <div>看相似</div>
  103. </div>
  104. </li>
  105. <li class="item">
  106. <a href=""><img src="images/3.webp" alt=""></a>
  107. <p>义婕秋冬装2020新款修身网纱针织连衣裙长款假两件套毛衣女套装裙A18-6507 黑色 S</p>
  108. <div class="price">
  109. <div class="iconfont icon-rmb">130 <span>满减</span></div>
  110. <div>看相似</div>
  111. </div>
  112. </li>
  113. <li class="item">
  114. <a href=""><img src="images/4.webp" alt=""></a>
  115. <p>羽绒服女中长款女士外套2020新品秋冬季亮面冬装派克服新款 17米白色 L(</p>
  116. <div class="price">
  117. <div class="iconfont icon-rmb">598</div>
  118. <div>看相似</div>
  119. </div>
  120. </li>
  121. <li class="item">
  122. <a href=""><img src="images/5.webp" alt=""></a>
  123. <p>义婕秋冬装2020新款修身网纱针织连衣裙长款假两件套毛衣女套装裙A18-6507 黑色 S</p>
  124. <div class="price">
  125. <div class="iconfont icon-rmb">130 <span>满减</span></div>
  126. <div>看相似</div>
  127. </div>
  128. </li>
  129. <li class="item">
  130. <a href=""><img src="images/6.webp" alt=""></a>
  131. <p>羽绒服女中长款女士外套2020新品秋冬季真毛领白鸭绒加厚装派克服新款 17米白色</p>
  132. <div class="price">
  133. <div class="iconfont icon-rmb">598</div>
  134. <div>看相似</div>
  135. </div>
  136. </li>
  137. <li class="item">
  138. <a href=""><img src="images/7.webp" alt=""></a>
  139. <p>义婕秋冬装2020新款修身网纱针织连衣裙长款假两件套毛衣女套装裙A18-6507 黑色 S</p>
  140. <div class="price">
  141. <div class="iconfont icon-rmb">130</div>
  142. <div>看相似</div>
  143. </div>
  144. </li>
  145. <li class="item">
  146. <a href=""><img src="images/8.webp" alt=""></a>
  147. <p>羽绒服女服大码亮面冬装派克服新款 17米白色 L(建议115斤-125斤)</p>
  148. <div class="price">
  149. <div class="iconfont icon-rmb">598 <span>满减</span></div>
  150. <div>看相似</div>
  151. </div>
  152. </li>
  153. </div>
  154. </main>
  155. <footer>
  156. <div>
  157. <div class="iconfont icon-home2"></div>
  158. <span>主页</span>
  159. </div>
  160. <div>
  161. <div class="iconfont icon-liebiao"></div>
  162. <span>分类</span>
  163. </div>
  164. <div>
  165. <div class="iconfont icon-31huiyuan"></div>
  166. <span>京喜</span>
  167. </div>
  168. <div>
  169. <div class="iconfont icon-cart"></div>
  170. <span>购物车</span>
  171. </div>
  172. <div>
  173. <div class="iconfont icon-31wodexuanzhong"></div>
  174. <span>未登录</span>
  175. </div>
  176. </footer>
  177. </body>
  178. </html>

CSS代码

  1. @import '../iconfont/iconfont.css';
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. li {
  8. list-style: none;
  9. }
  10. a {
  11. color: #7b7b7b;
  12. text-decoration: none;
  13. }
  14. body {
  15. background-color: #F6F6F6;
  16. }
  17. html {
  18. font-size: 10px;
  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. }
  35. @media screen and (min-width: 960px) {
  36. html {
  37. font-size: 18px;
  38. }
  39. }
  40. @media screen and (min-width: 1024px) {
  41. html {
  42. font-size: 20px;
  43. }
  44. }
  45. header {
  46. background-color: #C82519;
  47. height: 4.5rem;
  48. position: fixed;
  49. left: 0;
  50. right: 0;
  51. display: flex;
  52. justify-content: space-between;
  53. align-items: center;
  54. z-index: 100;
  55. }
  56. header .tubiao {
  57. flex: 0 1 5rem;
  58. color: white;
  59. font-size: 2.2rem;
  60. text-align: center;
  61. }
  62. header .search {
  63. flex: 10;
  64. color: white;
  65. display: flex;
  66. text-align: center;
  67. background-color: white;
  68. border-radius: 3rem;
  69. padding: 0.3rem;
  70. align-items: center;
  71. }
  72. header .search .logo {
  73. flex: 0 1 4rem;
  74. color: #E93B3D;
  75. font-size: 1.4rem;
  76. }
  77. header .search .search_icon {
  78. flex: 0 1 3rem;
  79. color: #666;
  80. font-size: 1.25rem;
  81. border-left: 1px solid #eee;
  82. }
  83. header .search .search_input {
  84. flex: auto;
  85. border: none;
  86. outline: none;
  87. color: #aaa;
  88. }
  89. header .login {
  90. flex: 0 1 5rem;
  91. color: white;
  92. font-size: 1.4rem;
  93. text-align: center;
  94. }
  95. footer {
  96. box-shadow: 10px 10px 15px #888888;
  97. background-color: #fff;
  98. height: 6rem;
  99. position: fixed;
  100. bottom: 0;
  101. left: 0;
  102. right: 0;
  103. color: #8B8B8B;
  104. }
  105. footer {
  106. display: flex;
  107. justify-content: space-around;
  108. align-items: center;
  109. }
  110. footer>div {
  111. display: flex;
  112. flex-flow: column nowrap;
  113. align-items: center;
  114. }
  115. footer>div>.iconfont {
  116. font-size: 2rem;
  117. }
  118. footer>div>span {
  119. font-size: 1rem;
  120. }
  121. main {
  122. min-height: 120vh;
  123. padding: 4.5rem 0;
  124. }
  125. main .banner {
  126. display: flex;
  127. flex-flow: column nowrap;
  128. }
  129. main .banner .banner_bg {
  130. background-color: #C82519;
  131. border-radius: 0 0rem 2rem 2em;
  132. height: 10rem;
  133. position: relative;
  134. }
  135. main .banner img {
  136. width: 90%;
  137. position: absolute;
  138. top: 5rem;
  139. left: 2rem;
  140. right: 2rem;
  141. margin: auto;
  142. border-radius: 1rem;
  143. }
  144. main .nav {
  145. margin-top: 8rem;
  146. display: flex;
  147. flex-wrap: wrap;
  148. }
  149. main .nav li {
  150. width: 20%;
  151. display: flex;
  152. flex-flow: column nowrap;
  153. align-items: center;
  154. font-size: 1.3rem;
  155. }
  156. main .nav li img {
  157. width: 5rem;
  158. }
  159. main .chaoliu {
  160. height: 12rem;
  161. background-color: white;
  162. margin: 2rem 0;
  163. }
  164. main .chaoliu .chaoliu_title {
  165. text-align: center;
  166. font-size: 1.8rem;
  167. padding: 0.5rem 0;
  168. }
  169. main .chaoliu .chaoliu_sp {
  170. display: flex;
  171. justify-content: center;
  172. }
  173. main .chaoliu .chaoliu_sp li {
  174. display: flex;
  175. flex-flow: column wrap;
  176. align-items: center;
  177. width: 25vw;
  178. font-size: 1.2rem;
  179. font-weight: 650;
  180. color: #000000;
  181. }
  182. main .chaoliu .chaoliu_sp li img {
  183. width: 6rem;
  184. }
  185. .title {
  186. height: 4rem;
  187. color: #555;
  188. font-weight: 500;
  189. text-align: center;
  190. line-height: 4rem;
  191. margin: 1rem 0;
  192. background-color: #e7e7e7;
  193. }
  194. main .hot {
  195. font-size: 1rem;
  196. display: flex;
  197. flex-wrap: wrap;
  198. margin-bottom: 1.5rem;
  199. }
  200. main .hot .item {
  201. flex: 1 1 calc(50% - 2rem);
  202. background-color: #fff;
  203. overflow: hidden;
  204. display: flex;
  205. flex-flow: column nowrap;
  206. margin-left: 1rem;
  207. margin-bottom: 1rem;
  208. padding-bottom: 1rem;
  209. border-radius: 1rem;
  210. }
  211. main .hot .item p {
  212. font-size: 1.2rem;
  213. color: #555;
  214. }
  215. main .hot .item img {
  216. width: 100%;
  217. height: 100%;
  218. }
  219. main .hot .item {
  220. padding: 1rem;
  221. }
  222. main .hot .item .price {
  223. display: flex;
  224. justify-content: space-between;
  225. }
  226. main .hot .item .price div:first-of-type {
  227. color: red;
  228. }
  229. main .hot .item .price div:first-of-type span {
  230. border: 1px solid red;
  231. border-radius: 0.5rem;
  232. padding: 0.2rem;
  233. font-size: 1.1rem;
  234. }
  235. main .hot .item .price div:last-of-type {
  236. color: #666;
  237. background-color: #f6f6f6;
  238. border-radius: 1rem;
  239. padding: 0.7rem 1rem;
  240. }

仿京东商城移动端网页