Blogger Information
Blog 10
fans 0
comment 0
visits 7421
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
flex实战京东页面
 有料!
Original
847 people have browsed it

京东app页面

  • rest.css全局初始化文件,媒体查询文件
  • 通过impoart公共文件
  • @media screen and (min-width: 480px)— font-size: 12px;
  • @media screen and (min-width: 640px)— font-size: 14px;
  • @media screen and (min-width: 720px)— font-size: 16px;
  • 通过媒体查询改变html文字大小,实现全局响应式
  • header,footer文件单独书写引入,模块通用,使用用绝对定位,z-inde属性等排在最上层

    页面效果

rest.css 全局代码实现

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. li {
  7. list-style: none;
  8. }
  9. a {
  10. color: #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. }
  1. @import "reset.css";
  2. .header {
  3. height: 2.5rem;
  4. background-color: #c82519;
  5. position: fixed;
  6. top: 0;
  7. left: 0;
  8. right: 0;
  9. z-index: 100;
  10. }
  11. .footer {
  12. height: 2.5rem;
  13. background-color: #ffffff;
  14. position: fixed;
  15. bottom: 0;
  16. left: 0;
  17. right: 0;
  18. z-index: 100;
  19. }
  20. .main {
  21. position: absolute;
  22. top: 2.5rem;
  23. left: 0;
  24. right: 0;
  25. bottom: 2.5rem;
  26. }
  27. /* ------------header头部------------------- */
  28. .header {
  29. display: flex;
  30. align-items: center;
  31. }
  32. .header .menu {
  33. color: white;
  34. flex: 1;
  35. text-align: center;
  36. font-size: 1.5625rem;
  37. }
  38. .header .search {
  39. flex: 6;
  40. background-color: white;
  41. border-radius: 0.9375rem;
  42. display: flex;
  43. align-items: center;
  44. }
  45. .header .search .jd {
  46. color: #c82519;
  47. flex: 0 1 2.5rem;
  48. text-align: center;
  49. font-size: 1.25rem;
  50. }
  51. .header .search .zoom {
  52. color: #aaa;
  53. border-left: 1px solid;
  54. flex: 0 1 2.5rem;
  55. text-align: center;
  56. }
  57. .header .search .words {
  58. outline: none;
  59. flex: auto;
  60. border: none;
  61. color: #aaa;
  62. margin-right: 0.5rem;
  63. }
  64. .header .login {
  65. color: white;
  66. flex: 1;
  67. text-align: center;
  68. }
  69. /* --------------尾部------------------------------------ */
  70. .footer {
  71. display: flex;
  72. justify-content: space-around;
  73. align-items: center;
  74. }
  75. .footer > div {
  76. color: #8b8b8b;
  77. text-align: center;
  78. }
  79. .footer > div > .iconfont {
  80. font-size: 1.25rem;
  81. }
  82. .footer > div > span {
  83. font-size: 0.625rem;
  84. }
  85. /* -------------------nav分类----------------------------- */
  86. .nav {
  87. padding: 0.625rem;
  88. display: flex;
  89. flex-flow: row wrap;
  90. justify-content: space-between;
  91. }
  92. .nav > li {
  93. flex: 1 1 20%;
  94. display: flex;
  95. flex-flow: column nowrap;
  96. align-items: center;
  97. }
  98. .nav > li > a > img {
  99. height: 2.5rem;
  100. }
  101. .nav > li > a {
  102. font-size: 0.75rem;
  103. }
  104. /* ----------------秒杀----------------------------------- */
  105. .main .ms {
  106. padding: 0 0.625rem;
  107. margin: 0.625rem;
  108. background-color: white;
  109. border-radius: 0.625rem;
  110. }
  111. .main .ms .ms-top {
  112. display: flex;
  113. justify-content: space-between;
  114. align-content: center;
  115. padding: 0.3125rem;
  116. display: flex;
  117. height: 1.875rem;
  118. }
  119. .main .ms .ms-top .ms-left {
  120. display: flex;
  121. align-content: center;
  122. }
  123. .main .ms .ms-top .ms-left .title {
  124. padding-right: 1.25rem;
  125. }
  126. .main .ms .ms-top .ms-left .ms-sj {
  127. color: #c82519;
  128. }
  129. .main .ms .ms-top .right {
  130. color: #c82519;
  131. }
  132. .main .ms .ms-body {
  133. display: flex;
  134. overflow: auto;
  135. }
  136. .ms-body .item {
  137. display: flex;
  138. flex-flow: column nowrap;
  139. text-align: center;
  140. padding: 0.625rem 0;
  141. }
  142. .ms-body .item > a > img {
  143. height: 100px;
  144. width: 100px;
  145. }
  146. .ms-body .item .iconfont:first-of-type {
  147. color: red;
  148. }
  149. .ms-body .item .iconfont:last-of-type {
  150. text-decoration: line-through;
  151. }
  152. /* ----------------------猜你喜欢--------------------------------------- */
  153. .cn {
  154. text-align: center;
  155. margin-bottom: 0.625rem;
  156. }
  157. .goods-like {
  158. display: flex;
  159. flex-flow: wrap;
  160. }
  161. .goods-like .like-top {
  162. flex: 1 1 calc(50% - 1.25rem);
  163. font-size: 0.75rem;
  164. display: flex;
  165. flex-flow: column;
  166. padding: 0.625rem;
  167. background-color: white;
  168. border-radius: 0.625rem;
  169. margin: 0.625rem;
  170. }
  171. .goods-like .like-top img {
  172. width: 100%;
  173. height: 100%;
  174. }
  175. .goods-like .like-top p {
  176. min-height: 32px;
  177. margin-top: 0.3125rem;
  178. overflow: hidden;
  179. text-overflow: ellipsis;
  180. display: -webkit-box;
  181. -webkit-line-clamp: 2;
  182. -webkit-box-orient: vertical;
  183. }
  184. .like-button {
  185. display: flex;
  186. margin-top: 16px;
  187. justify-content: space-between;
  188. }
  189. .like-button > span:first-of-type {
  190. color: red;
  191. }
  192. .like-button > span:last-of-type {
  193. color: #aaa;
  194. background-color: #f6f6f6;
  195. border-radius: 1rem;
  196. padding: 0.125rem 0.625rem;
  197. }
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. <title>Document</title>
  8. <link rel="stylesheet" href="static/css/index.css">
  9. <link rel="stylesheet" href="static/icon-font/iconfont.css">
  10. </head>
  11. <body>
  12. <header class="header">
  13. <div class="menu iconfont icon-menu"></div>
  14. <div class="search">
  15. <div class="jd">JD</div>
  16. <div class="zoom iconfont icon-search"></div>
  17. <input type="text" class="words" value="扫描仪">
  18. </div>
  19. <a href="#" class="login">登录</a>
  20. </header>
  21. <div class="main">
  22. <ul class="nav">
  23. <li>
  24. <a href=""><img src="static/images/dh/nav-1.png" alt=""></a>
  25. <a href="">京东超市</a>
  26. </li>
  27. <li>
  28. <a href=""><img src="static/images/dh/nav-2.png" alt=""></a>
  29. <a href="">数码电器</a>
  30. </li>
  31. <li>
  32. <a href=""><img src="static/images/dh/nav-3.png" alt=""></a>
  33. <a href="">京东服饰</a>
  34. </li>
  35. <li>
  36. <a href=""><img src="static/images/dh/nav-4.png" alt=""></a>
  37. <a href="">京东生鲜</a>
  38. </li>
  39. <li>
  40. <a href=""><img src="static/images/dh/nav-5.png" alt=""></a>
  41. <a href="">京东到家</a>
  42. </li>
  43. <!-- 第二组 -->
  44. <li>
  45. <a href=""><img src="static/images/dh/nav-6.png" alt=""></a>
  46. <a href="">充值缴费</a>
  47. </li>
  48. <li>
  49. <a href=""><img src="static/images/dh/nav-7.png" alt=""></a>
  50. <a href="">9.9元拼</a>
  51. </li>
  52. <li>
  53. <a href=""><img src="static/images/dh/nav-8.png" alt=""></a>
  54. <a href="">领券</a>
  55. </li>
  56. <li>
  57. <a href=""><img src="static/images/dh/nav-9.png" alt=""></a>
  58. <a href="">领金贴</a>
  59. </li>
  60. <li>
  61. <a href=""><img src="static/images/dh/nav-10.png" alt=""></a>
  62. <a href="">PLUS会员</a>
  63. </li>
  64. </ul>
  65. <div class="ms">
  66. <div class="ms-top">
  67. <div class="ms-left">
  68. <div class="title">京东秒杀</div>
  69. <div class="ms-sj">01:02:03</div>
  70. </div>
  71. <div class="right">更多秒杀</div>
  72. </div>
  73. <ul class="ms-body">
  74. <li class="item">
  75. <a href=""><img src="static/images/ms/ms-1.jpg" alt=""></a>
  76. <div class="iconfont icon-rmb">338</div>
  77. <div class="iconfont icon-rmb">558</div>
  78. </li>
  79. <li class="item">
  80. <a href=""><img src="static/images/ms/ms-2.jpg" alt=""></a>
  81. <div class="iconfont icon-rmb">3456</div>
  82. <div class="iconfont icon-rmb">4567</div>
  83. </li>
  84. <li class="item">
  85. <a href=""><img src="static/images/ms/ms-3.jpg" alt=""></a>
  86. <div class="iconfont icon-rmb">789</div>
  87. <div class="iconfont icon-rmb">999</div>
  88. </li>
  89. <li class="item">
  90. <a href=""><img src="static/images/ms/ms-4.jpg" alt=""></a>
  91. <div class="iconfont icon-rmb">3213</div>
  92. <div class="iconfont icon-rmb">4532</div>
  93. </li>
  94. </ul>
  95. </div>
  96. <!-- -----------------猜你喜欢 ---------------------------->
  97. <h2 class="cn">猜你喜欢</h2>
  98. <div class="goods-like">
  99. <div class="like-top">
  100. <img src="static/images/sp/sp-1.webp" alt="" />
  101. <p> 翻斗鞋柜超薄门厅柜17cm大容量家具组装客厅简约现代 柚</p>
  102. <div class="like-button">
  103. <span>399</span>
  104. <span>看相似</span>
  105. </div>
  106. </div>
  107. <div class="like-top">
  108. <img src="static/images/sp/sp-2.webp" alt="" />
  109. <p> 翻斗鞋柜超薄门厅柜17cm大容量家具组装客厅简约现代 柚木 </p>
  110. <div class="like-button">
  111. <span>399</span>
  112. <span>看相似</span>
  113. </div>
  114. </div>
  115. <div class="like-top">
  116. <img src="static/images/sp/sp-3.webp" alt="" />
  117. <p> 翻斗鞋柜超薄门厅柜17cm大容量家具组装客厅简约现代 柚木色</p>
  118. <div class="like-button">
  119. <span>399</span>
  120. <span>看相似</span>
  121. </div>
  122. </div>
  123. <div class="like-top">
  124. <img src="static/images/sp/sp-4.webp" alt="" />
  125. <p> 翻斗鞋柜超薄门厅柜17cm大容量家具组装客厅简约现代木色 </p>
  126. <div class="like-button">
  127. <span>399</span>
  128. <span>看相似</span>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <footer class="footer">
  134. <div>
  135. <div class="iconfont icon-home"></div>
  136. <div>首页</div>
  137. </div>
  138. <div>
  139. <div class="iconfont icon-layers"></div>
  140. <div>分类</div>
  141. </div>
  142. <div>
  143. <div class="iconfont icon-kehuguanli"></div>
  144. <div>惊喜</div>
  145. </div>
  146. <div>
  147. <div class="iconfont icon-shopping-cart "></div>
  148. <div>购物车</div>
  149. </div>
  150. <div>
  151. <div class="iconfont icon-user "></div>
  152. <div>我的</div>
  153. </div>
  154. </footer>
  155. </body>
  156. </html>
Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!