博客列表 >京东app首页练习

京东app首页练习

咸鱼老爷
咸鱼老爷原创
2021年02月26日 17:28:32724浏览

效果图

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. <link rel="stylesheet" href="css/jd.css">
  8. <link rel="stylesheet" href="font/iconfont.css">
  9. </head>
  10. <body>
  11. <header>
  12. <div class="menu iconfont icon-caidan"></div>
  13. <div class="search">
  14. <div class="logo">JD</div>
  15. <div class="zoom iconfont icon-sousuo"></div>
  16. <input type="text" class="words" value="鼠标">
  17. </div>
  18. <a href="" class="login">登录</a>
  19. </header>
  20. <main>
  21. <ul class="nav">
  22. <li>
  23. <a href=""><img src="images/dh/nav-1.png" alt=""></a>
  24. <a href="">京东超市</a>
  25. </li>
  26. <li>
  27. <a href=""><img src="images/dh/nav-2.png" alt=""></a>
  28. <a href="">京东超市</a>
  29. </li>
  30. <li>
  31. <a href=""><img src="images/dh/nav-3.png" alt=""></a>
  32. <a href="">京东超市</a>
  33. </li>
  34. <li>
  35. <a href=""><img src="images/dh/nav-4.png" alt=""></a>
  36. <a href="">京东超市</a>
  37. </li>
  38. <li>
  39. <a href=""><img src="images/dh/nav-5.png" alt=""></a>
  40. <a href="">京东超市</a>
  41. </li>
  42. <li>
  43. <a href=""><img src="images/dh/nav-6.png" alt=""></a>
  44. <a href="">京东超市</a>
  45. </li>
  46. <li>
  47. <a href=""><img src="images/dh/nav-7.png" alt=""></a>
  48. <a href="">京东超市</a>
  49. </li>
  50. <li>
  51. <a href=""><img src="images/dh/nav-8.png" alt=""></a>
  52. <a href="">京东超市</a>
  53. </li>
  54. <li>
  55. <a href=""><img src="images/dh/nav-9.png" alt=""></a>
  56. <a href="">京东超市</a>
  57. </li>
  58. <li>
  59. <a href=""><img src="images/dh/nav-10.png" alt=""></a>
  60. <a href="">京东超市</a>
  61. </li>
  62. </ul>
  63. <div class="ms">
  64. <div class="ms-top">
  65. <div class="left">
  66. <div class="title">京东秒杀</div>
  67. <div class="notic">
  68. <div class="tips">22点专场</div>
  69. <div class="time">01:11:22</div>
  70. </div>
  71. </div>
  72. <div class="right"><a href="">更多秒杀</a></div>
  73. </div>
  74. <ul class="ms-body">
  75. <li class="item">
  76. <a href=""><img src="images/ms/ms-1.jpg" alt=""></a>
  77. <div>¥338</div>
  78. <div>¥558</div>
  79. </li>
  80. <li class="item">
  81. <a href=""><img src="images/ms/ms-2.jpg" alt=""></a>
  82. <div>¥338</div>
  83. <div>¥558</div>
  84. </li>
  85. <li class="item">
  86. <a href=""><img src="images/ms/ms-3.jpg" alt=""></a>
  87. <div>¥338</div>
  88. <div>¥558</div>
  89. </li>
  90. <li class="item">
  91. <a href=""><img src="images/ms/ms-4.jpg" alt=""></a>
  92. <div>¥338</div>
  93. <div>¥558</div>
  94. </li>
  95. </ul>
  96. </div>
  97. <h3 class="title">猜你喜欢</h3>
  98. <ul class="tj">
  99. <li class="item">
  100. <a href=""><img src="images/sp/sp-1.webp" alt=""></a>
  101. <a href="" class="ttitle">商品标题商品标题商品标题商品标题商品标题商品标题商品标题商品标题商品标题</a>
  102. <div class="price">
  103. <div>¥203</div>
  104. <div>看相似</div>
  105. </div>
  106. </li>
  107. <li class="item">
  108. <a href=""><img src="images/sp/sp-2.webp" alt=""></a>
  109. <a href="" class="title">商品介绍</a>
  110. <div class="price">
  111. <div>¥203</div>
  112. <div>看相似</div>
  113. </div>
  114. </li>
  115. <li class="item">
  116. <a href=""><img src="images/sp/sp-3.webp" alt=""></a>
  117. <a href="" class="title">商品介绍</a>
  118. <div class="price">
  119. <div>¥203</div>
  120. <div>看相似</div>
  121. </div>
  122. </li>
  123. <li class="item">
  124. <a href=""><img src="images/sp/sp-4.webp" alt=""></a>
  125. <a href="" class="title">商品介绍</a>
  126. <div class="price">
  127. <div>¥203</div>
  128. <div>看相似</div>
  129. </div>
  130. </li>
  131. </ul>
  132. </main>
  133. <footer>
  134. <div>
  135. <div class="iconfont icon-shouye"></div>
  136. <a href="">主页</a>
  137. </div>
  138. <div>
  139. <div class="iconfont icon-fenlei"></div>
  140. <a href="">分类</a>
  141. </div>
  142. <div>
  143. <div class="iconfont icon-gouwuche"></div>
  144. <a href="">购物车</a>
  145. </div>
  146. <div>
  147. <div class="iconfont icon-shebei
  148. icon-iconfonticon-shebei"></div>
  149. <a href="">惊喜</a>
  150. </div>
  151. <div>
  152. <div class="iconfont icon-yonghu"></div>
  153. <a href="">未登录</a>
  154. </div>
  155. </footer>
  156. </body>
  157. </html>

css代码

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. body {
  7. background-color: #f6f6f6;
  8. }
  9. li {
  10. list-style: none;
  11. }
  12. a {
  13. text-decoration: none;
  14. outline: none;
  15. }
  16. html {
  17. font-size: 10px;
  18. }
  19. header {
  20. height: 4.4rem;
  21. color: white;
  22. background-color: #e43130;
  23. position: fixed;
  24. top: 0;
  25. left: 0;
  26. right: 0;
  27. z-index: 100;
  28. display: flex;
  29. align-items: center;
  30. font-size: 1.4rem;
  31. justify-content: space-between;
  32. }
  33. footer {
  34. height: 4.4rem;
  35. background-color: #fff;
  36. position: fixed;
  37. left: 0;
  38. right: 0;
  39. bottom: 0;
  40. box-shadow: 0 0 3px #999;
  41. z-index: 999;
  42. display: flex;
  43. justify-content: space-around;
  44. align-items: center;
  45. font-size: 1.4rem;
  46. }
  47. main {
  48. min-height: 100em;
  49. position: absolute;
  50. top: 4.4rem;
  51. bottom: 4.4rem;
  52. left: 0;
  53. right: 0;
  54. font-size: 1.4rem;
  55. }
  56. header .menu,
  57. header .login {
  58. flex: 1;
  59. color: white;
  60. text-align: center;
  61. }
  62. header .menu {
  63. font-size: 2.5rem;
  64. }
  65. header .search {
  66. flex: 6;
  67. padding: 0.5rem;
  68. background-color: #fff;
  69. border-radius: 3rem;
  70. display: flex;
  71. }
  72. header .search .logo {
  73. color: #e43130;
  74. flex: 0 1 4rem;
  75. font-size: 2rem;
  76. text-align: center;
  77. line-height: 2rem;
  78. }
  79. header .search .zoom {
  80. color: #ccc;
  81. flex: 0 1 4rem;
  82. font-size: 2rem;
  83. border-left: 1px solid;
  84. text-align: center;
  85. line-height: 2rem;
  86. }
  87. header .search .words {
  88. flex: auto;
  89. border: none;
  90. outline: none;
  91. color: #aaa;
  92. }
  93. main .nav {
  94. padding: 1rem;
  95. display: flex;
  96. flex-flow: row wrap;
  97. justify-content: space-between
  98. }
  99. main .nav a:last-of-type {
  100. color: #666;
  101. }
  102. main .nav img {
  103. width: 4rem;
  104. height: 4rem;
  105. }
  106. main .nav li {
  107. flex: 1 1 20%;
  108. display: flex;
  109. flex-flow: column nowrap;
  110. align-items: center;
  111. }
  112. main .ms {
  113. background-color: #fff;
  114. padding: 1rem;
  115. margin: 1rem 0;
  116. }
  117. main .ms .ms-top {
  118. font-size: 1.3rem;
  119. height: 3rem;
  120. display: flex;
  121. justify-content: space-between;
  122. }
  123. main .ms .ms-top .left {
  124. display: flex;
  125. }
  126. main .ms .ms-top .left .notic {
  127. font-size: 1.1rem;
  128. height: 2rem;
  129. display: flex;
  130. border: 1px solid #e43130;
  131. border-radius: 2rem;
  132. margin-left: 1rem;
  133. justify-content: center;
  134. align-items: center;
  135. }
  136. main .ms .ms-top .left .notic .tips {
  137. background-color: #e43130;
  138. color: white;
  139. border-radius: 2rem;
  140. padding: 0.3rem 0.5rem;
  141. }
  142. main .ms .ms-top .left .notic .time {
  143. padding: 0.3rem 0.5rem;
  144. }
  145. main .ms .ms-top .right a {
  146. color: #e43130;
  147. }
  148. main .ms .ms-body {
  149. display: flex;
  150. justify-content: space-between;
  151. overflow: hidden;
  152. }
  153. main .ms .ms-body img {
  154. width: 12rem;
  155. height: 12rem;
  156. }
  157. main .ms .ms-body .item {
  158. display: flex;
  159. flex-flow: column nowrap;
  160. justify-content: center;
  161. align-items: center;
  162. }
  163. main .ms .ms-body .item div:first-of-type {
  164. color: #e43130;
  165. font-weight: bolder;
  166. }
  167. main .ms .ms-body .item div:last-of-type {
  168. color: #666;
  169. text-decoration: line-through;
  170. text-decoration-color: #666;
  171. }
  172. main .title {
  173. color: #555;
  174. height: 4rem;
  175. text-align: center;
  176. }
  177. main .tj {
  178. display: flex;
  179. flex-wrap: wrap;
  180. }
  181. main .tj .item {
  182. flex: 1 1 calc(50% - 2rem);
  183. display: flex;
  184. flex-flow: column nowrap;
  185. background-color: #fff;
  186. margin-left: 1rem;
  187. margin-bottom: 1rem;
  188. padding-bottom: 1rem;
  189. border-radius: 1rem;
  190. }
  191. main .tj .item img {
  192. width: 100%;
  193. height: 100%;
  194. }
  195. main .tj .item .ttitle {
  196. color: #a1a1a1;
  197. overflow: hidden;
  198. text-overflow: ellipsis;
  199. margin: .2rem 0;
  200. word-break: break-all;
  201. }
  202. main .tj .item .price {
  203. display: flex;
  204. justify-content: space-between;
  205. }
  206. main .tj .item .price div:first-of-type {
  207. color: #e43130;
  208. }
  209. main .tj .item .price div:last-of-type {
  210. color: #666;
  211. background-color: #f6f6f6;
  212. border-radius: 1rem;
  213. padding: 0.2rem 1rem;
  214. }
  215. footer>div {
  216. display: flex;
  217. flex-flow: column nowrap;
  218. align-items: center;
  219. margin: .8rem 1rem;
  220. }
  221. footer>div>.iconfont {
  222. font-size: 1.5rem;
  223. color: #666;
  224. }
  225. footer>div>a {
  226. color: #666;
  227. font-size: 1rem;
  228. }
  229. @media screen and (min-width:480px) {
  230. html {
  231. font-size: 12px;
  232. }
  233. }
  234. @media screen and (min-width:640px) {
  235. html {
  236. font-size: 14px;
  237. }
  238. }
  239. @media screen and (min-width:720px) {
  240. html {
  241. font-size: 16px;
  242. }
  243. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议