Blogger Information
Blog 13
fans 1
comment 0
visits 9871
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
京东手机端页面实战
大宇
Original
841 people have browsed it

  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/css/index.css" />
  8. <link rel="stylesheet" href="static/icon-font/iconfont.css" />
  9. <link rel="stylesheet" href="static/css/header.css" />
  10. <link rel="stylesheet" href="static/css/footer.css" />
  11. <link rel="stylesheet" href="static/css/nav.css" />
  12. <link rel="stylesheet" href="static/css/ms.css" />
  13. <link rel="stylesheet" href="static/css/tj.css" />
  14. <title>页眉+页脚+主导航+秒杀区+推荐商品列表区</title>
  15. </head>
  16. <body>
  17. <div class="header">
  18. <!-- 菜单 -->
  19. <div class="menu iconfont icon-menu"></div>
  20. <!-- 搜索框 -->
  21. <div class="search">
  22. <div class="logo">JD</div>
  23. <div class="zoom iconfont icon-search"></div>
  24. <input type="text" class="words" value="移动硬盘5000g" id="" />
  25. </div>
  26. <!-- 登录按钮 -->
  27. <a href="" class="login">登录</a>
  28. </div>
  29. <!-- 主体 -->
  30. <div class="main">
  31. <!-- 主导航区 -->
  32. <ul class="nav">
  33. <li>
  34. <a href=""><img src="static/images/dh/nav-1.png" alt="" /></a>
  35. <a href="">京东超市</a>
  36. </li>
  37. <li>
  38. <a href=""><img src="static/images/dh/nav-2.png" alt="" /></a>
  39. <a href="">数码电器</a>
  40. </li>
  41. <li>
  42. <a href=""><img src="static/images/dh/nav-3.png" alt="" /></a>
  43. <a href="">京东服饰</a>
  44. </li>
  45. <li>
  46. <a href=""><img src="static/images/dh/nav-4.png" alt="" /></a>
  47. <a href="">京东生鲜</a>
  48. </li>
  49. <li>
  50. <a href=""><img src="static/images/dh/nav-5.png" alt="" /></a>
  51. <a href="">充值缴费</a>
  52. </li>
  53. <li>
  54. <a href=""><img src="static/images/dh/nav-6.png" alt="" /></a>
  55. <a href="">9.9元拼</a>
  56. </li>
  57. <li>
  58. <a href=""><img src="static/images/dh/nav-7.png" alt="" /></a>
  59. <a href="">领劵</a>
  60. </li>
  61. <li>
  62. <a href=""><img src="static/images/dh/nav-8.png" alt="" /></a>
  63. <a href="">领津贴</a>
  64. </li>
  65. <li>
  66. <a href=""><img src="static/images/dh/nav-9.png" alt="" /></a>
  67. <a href="">PLUS会员</a>
  68. </li>
  69. <li>
  70. <a href=""><img src="static/images/dh/nav-10.png" alt="" /></a>
  71. <a href="">数码电器</a>
  72. </li>
  73. </ul>
  74. <!-- 秒杀区 -->
  75. <div class="ms">
  76. <div class="ms-top">
  77. <div class="left">
  78. <div class="title">京东秒杀</div>
  79. <div class="notice">
  80. <div class="tips">20点专场</div>
  81. <div class="time">01:40:33</div>
  82. </div>
  83. </div>
  84. <div class="right">更多秒杀</div>
  85. </div>
  86. <!-- 秒杀主体区 -->
  87. <ul class="ms-body">
  88. <li class="item">
  89. <a href=""><img src="static/images/ms/ms-1.jpg" alt="" /></a>
  90. <div class="iconfont icon-rmb">338</div>
  91. <div class="iconfont icon-rmb">558</div>
  92. </li>
  93. <li class="item">
  94. <a href=""><img src="static/images/ms/ms-2.jpg" alt="" /></a>
  95. <div class="iconfont icon-rmb">338</div>
  96. <div class="iconfont icon-rmb">558</div>
  97. </li>
  98. <li class="item">
  99. <a href=""><img src="static/images/ms/ms-3.jpg" alt="" /></a>
  100. <div class="iconfont icon-rmb">338</div>
  101. <div class="iconfont icon-rmb">558</div>
  102. </li>
  103. <li class="item">
  104. <a href=""><img src="static/images/ms/ms-4.jpg" alt="" /></a>
  105. <div class="iconfont icon-rmb">338</div>
  106. <div class="iconfont icon-rmb">558</div>
  107. </li>
  108. </ul>
  109. </div>
  110. <!-- 推荐商品列表区 -->
  111. <ul class="tj">
  112. <li class="item">
  113. <a href=""><img src="static/images/sp/sp-1.webp" alt="" /></a>
  114. <p>
  115. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  116. </p>
  117. <div class="price">
  118. <div class="iconfont icon-rmb">138</div>
  119. <div>看相似</div>
  120. </div>
  121. </li>
  122. <li class="item">
  123. <a href=""><img src="static/images/sp/sp-2.webp" alt="" /></a>
  124. <p>
  125. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  126. </p>
  127. <div class="price">
  128. <div class="iconfont icon-rmb">138</div>
  129. <div>看相似</div>
  130. </div>
  131. </li>
  132. <li class="item">
  133. <a href=""><img src="static/images/sp/sp-3.webp" alt="" /></a>
  134. <p>
  135. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  136. </p>
  137. <div class="price">
  138. <div class="iconfont icon-rmb">138</div>
  139. <div>看相似</div>
  140. </div>
  141. </li>
  142. <li class="item">
  143. <a href=""><img src="static/images/sp/sp-4.webp" alt="" /></a>
  144. <p>
  145. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  146. </p>
  147. <div class="price">
  148. <div class="iconfont icon-rmb">138</div>
  149. <div>看相似</div>
  150. </div>
  151. </li>
  152. <li class="item">
  153. <a href=""><img src="static/images/sp/sp-5.webp" alt="" /></a>
  154. <p>
  155. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  156. </p>
  157. <div class="price">
  158. <div class="iconfont icon-rmb">138</div>
  159. <div>看相似</div>
  160. </div>
  161. </li>
  162. <li class="item">
  163. <a href=""><img src="static/images/sp/sp-6.webp" alt="" /></a>
  164. <p>
  165. 商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍
  166. </p>
  167. <div class="price">
  168. <div class="iconfont icon-rmb">138</div>
  169. <div>看相似</div>
  170. </div>
  171. </li>
  172. </ul>
  173. </div>
  174. <!-- 页脚 -->
  175. <div class="footer">
  176. <div>
  177. <div class="iconfont icon-home"></div>
  178. <span>首页</span>
  179. </div>
  180. <div>
  181. <div class="iconfont icon-home"></div>
  182. <span>分类</span>
  183. </div>
  184. <div>
  185. <div class="iconfont icon-home"></div>
  186. <span>京喜</span>
  187. </div>
  188. <div>
  189. <div class="iconfont icon-home"></div>
  190. <span>购物车</span>
  191. </div>
  192. <div>
  193. <div class="iconfont icon-home"></div>
  194. <span>未登录</span>
  195. </div>
  196. </div>
  197. </body>
  198. </html>

reset.css

  1. * {
  2. margin: 0px;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. li {
  7. /* 去掉前面的点 */
  8. list-style: none;
  9. }
  10. a {
  11. /* 去掉下划线 */
  12. text-decoration: none;
  13. color: #7b7b7b;
  14. }
  15. body {
  16. background-color: #f6f6f6;
  17. }
  18. html {
  19. font-size: 10px;
  20. }
  21. body {
  22. font-size: 1.6rem;
  23. }
  24. @media screen and (min-width: 480px) {
  25. html {
  26. font-size: 12px;
  27. }
  28. }
  29. @media screen and (min-width: 640px) {
  30. html {
  31. font-size: 14px;
  32. }
  33. }
  34. @media screen and (min-width: 720px) {
  35. html {
  36. font-size: 16px;
  37. }
  38. }

index.css

  1. /* @import url("reset.css"); */
  2. @import "reset.css";
  3. .header {
  4. background-color: #e43130;
  5. color: #fff;
  6. height: 4.4rem;
  7. /* 固定定位 */
  8. position: fixed;
  9. left: 0;
  10. top: 0;
  11. right: 0;
  12. /* 保证他始终在视口的最前面 */
  13. z-index: 100;
  14. }
  15. /* 主体绝对定位 */
  16. .main {
  17. position: absolute;
  18. top: 4.4rem;
  19. left: 0;
  20. right: 0;
  21. bottom: 4.4rem;
  22. }
  23. .footer {
  24. background-color: #eee;
  25. color: #fff;
  26. height: 4.4rem;
  27. /* 固定定位 */
  28. position: fixed;
  29. left: 0;
  30. bottom: 0;
  31. right: 0;
  32. z-index: 100;
  33. }

footer.css

  1. .footer {
  2. display: flex;
  3. justify-content: space-around;
  4. align-items: center;
  5. color: #666;
  6. }
  7. .footer > div {
  8. display: flex;
  9. flex-flow: column nowrap;
  10. /* 主轴垂直 交叉轴水平 */
  11. align-items: center;
  12. }
  13. .footer > div .iconfont {
  14. font-size: 2rem;
  15. }
  16. .footer > div > span {
  17. font-size: 1rem;
  18. }
  19. .footer > div:hover {
  20. cursor: pointer;
  21. }

header.css

  1. /* 使用一个类作为入口,后面可以使用class或伪类来获取内部的每一个元素。 */
  2. .header {
  3. display: flex;
  4. flex-flow: row nowrap;
  5. align-items: center;
  6. }
  7. .header .menu {
  8. flex: 1;
  9. /* 行内元素 文本居中 */
  10. text-align: center;
  11. font-size: 2.5rem;
  12. }
  13. .header .login {
  14. flex: 1;
  15. color: white;
  16. text-align: center;
  17. }
  18. .header .search {
  19. flex: 6;
  20. padding: 0.5rem;
  21. background-color: #fff;
  22. /* 圆角 */
  23. border-radius: 3rem;
  24. display: flex;
  25. }
  26. .header .search .logo {
  27. color: #e43130;
  28. font-size: 2rem;
  29. flex: 0 1 4rem;
  30. text-align: center;
  31. line-height: 2rem;
  32. }
  33. .header .search .zoom {
  34. color: #ccc;
  35. flex: 0 1 4rem;
  36. text-align: center;
  37. /* 垂直居中 */
  38. line-height: 2rem;
  39. border-left: 1px solid;
  40. }
  41. .header .search .words {
  42. flex: auto;
  43. border: none;
  44. outline: none;
  45. color: #aaa;
  46. }

nav.css

  1. /* 主导航区样式 */
  2. /* 图片 */
  3. .main nav img {
  4. height: 4rem;
  5. width: 4rem;
  6. }
  7. /* 导航区 */
  8. .main .nav {
  9. /* border: 1px solid #000; */
  10. padding: 1rem;
  11. display: flex;
  12. /* 转为多行容器 */
  13. flex-flow: row wrap;
  14. }
  15. .main .nav li {
  16. flex-grow: 1;
  17. flex-shrink: 0;
  18. flex-basis: 20%;
  19. /* border: 1px solid #000; */
  20. /* flex: 1 1 20%; */
  21. display: flex;
  22. flex-flow: column nowrap;
  23. align-items: center;
  24. }

tj.css

  1. .main .tj {
  2. font-size: 1.1rem;
  3. color: #555;
  4. display: flex;
  5. /* 当前一行只显示两个 所以转为多行容器 允许换行 */
  6. flex-flow: row wrap;
  7. justify-content: center;
  8. }
  9. .main .tj .item {
  10. flex-basis: calc(50% - 3rem);
  11. padding: 1rem;
  12. background-color: #fff;
  13. display: flex;
  14. flex-flow: column nowrap;
  15. /* 添加外边距 */
  16. margin-left: 1rem;
  17. margin-bottom: 1rem;
  18. border-radius: 1rem;
  19. }
  20. .main .th .item:nth-of-type(2n) {
  21. margin-right: 1rem;
  22. }
  23. .main .tj .item img {
  24. width: 100%;
  25. height: 100%;
  26. }
  27. .main .tj .item .price {
  28. display: flex;
  29. justify-content: space-between;
  30. }
  31. .main .tj .item .price div:first-of-type {
  32. color: red;
  33. font-weight: bolder;
  34. }
  35. .main .tj .item .price div:last-of-type {
  36. background-color: #f6f6f6;
  37. padding: 0.2rem 1rem;
  38. border-radius: 1rem;
  39. color: #666;
  40. }
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post