博客列表 >京东app首页布局

京东app首页布局

豌豆君
豌豆君原创
2021年03月19日 19:16:411415浏览

index.html

主页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. <title>京东</title>
  7. <!-- 字体图标 -->
  8. <link rel="stylesheet" href="static/icon-font/iconfont.css">
  9. <!-- 首页 -->
  10. <link rel="stylesheet" href="static/css/index.css">
  11. <!-- 页眉 -->
  12. <link rel="stylesheet" href="static/css/header.css">
  13. <!-- 广告区 -->
  14. <link rel="stylesheet" href="static/css/banner.css">
  15. <!-- 导航区 -->
  16. <link rel="stylesheet" href="static/css/nav.css">
  17. <!-- 正品直邮区 -->
  18. <link rel="stylesheet" href="static/css/zp.css">
  19. <!-- 秒杀区 -->
  20. <link rel="stylesheet" href="static/css/ms.css">
  21. <!-- 活动区 -->
  22. <link rel="stylesheet" href="static/css/hd.css">
  23. <!-- 推荐:猜你喜欢 -->
  24. <link rel="stylesheet" href="static/css/tj.css">
  25. <!-- 声明 -->
  26. <link rel="stylesheet" href="static/css/sm.css">
  27. <!-- 页脚 -->
  28. <link rel="stylesheet" href="static/css/footer.css">
  29. </head>
  30. <body>
  31. <!-- 页眉 -->
  32. <div class="header">
  33. <!-- 字体图标菜单 -->
  34. <div class="menu iconfont icon-menu"></div>
  35. <!-- 搜索框 -->
  36. <div class="search">
  37. <div class="logo">JD</div>
  38. <div class="zoom iconfont icon-search"></div>
  39. <input class="words" type="text" value="蓝牙鼠标">
  40. </div>
  41. <!-- 登录按钮 -->
  42. <a href="" class="login">登录</a>
  43. </div>
  44. <!-- 主体 -->
  45. <div class="main">
  46. <!-- 主导航区 -->
  47. <ul class="banner">
  48. <a href=""><img src="static/images/bg/banner.jpg" alt=""></a>
  49. </ul>
  50. <!-- 主导航区 -->
  51. <ul class="nav">
  52. <!-- 第一组 -->
  53. <li>
  54. <a href=""><img src="static/images/dh/nav-1.png" alt=""></a>
  55. <a href="">京东超市</a>
  56. </li>
  57. <li>
  58. <a href=""><img src="static/images/dh/nav-2.png" alt=""></a>
  59. <a href="">数码电器</a>
  60. </li>
  61. <li>
  62. <a href=""><img src="static/images/dh/nav-3.png" alt=""></a>
  63. <a href="">京东服饰</a>
  64. </li>
  65. <li>
  66. <a href=""><img src="static/images/dh/nav-4.png" alt=""></a>
  67. <a href="">京东生鲜</a>
  68. </li>
  69. <li>
  70. <a href=""><img src="static/images/dh/nav-5.png" alt=""></a>
  71. <a href="">京东到家</a>
  72. </li>
  73. <!-- 第二组 -->
  74. <li>
  75. <a href=""><img src="static/images/dh/nav-6.png" alt=""></a>
  76. <a href="">充值缴费</a>
  77. </li>
  78. <li>
  79. <a href=""><img src="static/images/dh/nav-7.png" alt=""></a>
  80. <a href="">9.9元拼</a>
  81. </li>
  82. <li>
  83. <a href=""><img src="static/images/dh/nav-8.png" alt=""></a>
  84. <a href="">领券</a>
  85. </li>
  86. <li>
  87. <a href=""><img src="static/images/dh/nav-9.png" alt=""></a>
  88. <a href="">领金贴</a>
  89. </li>
  90. <li>
  91. <a href=""><img src="static/images/dh/nav-10.png" alt=""></a>
  92. <a href="">PLUS会员</a>
  93. </li>
  94. </ul>
  95. <!-- 正品直邮区 -->
  96. <ul class="zp">
  97. <li class="item">
  98. <div class="title">
  99. <a href=""></a>
  100. <a href="">正品直邮</a>
  101. </div>
  102. <a href=""><img src="static/images/zp/zp-1.jpg" alt=""></a>
  103. </li>
  104. <li class="item">
  105. <div class="title">
  106. <a href="">来电好货</a>
  107. <a href="">3c大放价</a>
  108. </div>
  109. <a href=""><img src="static/images/zp/zp-2.jpg" alt=""></a>
  110. </li>
  111. <li class="item">
  112. <div class="title">
  113. <a href="">国潮风尚</a>
  114. <a href="">正品直邮</a>
  115. </div>
  116. <a href=""><img src="static/images/zp/zp-3.jpg" alt=""></a>
  117. </li>
  118. <li class="item">
  119. <div class="title">
  120. <a href=""></a>
  121. <a href="">都是你爱的</a>
  122. </div>
  123. <a href=""><img src="static/images/zp/zp-4.jpg" alt=""></a>
  124. </li>
  125. </ul>
  126. <!-- 秒杀区 -->
  127. <div class="ms">
  128. <div class="ms-top">
  129. <div class="left">
  130. <div class="title">京东秒杀</div>
  131. <div class="notice">
  132. <div class="tips">22点专场</div>
  133. <div class="time">00:11:22</div>
  134. </div>
  135. </div>
  136. <div class="right">更多秒杀>></div>
  137. </div>
  138. <ul class="ms-body">
  139. <li class="item">
  140. <a href=""><img src="static/images/ms/ms-1.jpg" alt=""></a>
  141. <div class="iconfont icon-rmb">338</div>
  142. <div class="iconfont icon-rmb">558</div>
  143. </li>
  144. <li class="item">
  145. <a href=""><img src="static/images/ms/ms-2.jpg" alt=""></a>
  146. <div class="iconfont icon-rmb">3456</div>
  147. <div class="iconfont icon-rmb">4567</div>
  148. </li>
  149. <li class="item">
  150. <a href=""><img src="static/images/ms/ms-3.jpg" alt=""></a>
  151. <div class="iconfont icon-rmb">666</div>
  152. <div class="iconfont icon-rmb">999</div>
  153. </li>
  154. <li class="item">
  155. <a href=""><img src="static/images/ms/ms-4.jpg" alt=""></a>
  156. <div class="iconfont icon-rmb">3456</div>
  157. <div class="iconfont icon-rmb">4658</div>
  158. </li>
  159. </ul>
  160. </div>
  161. <!-- 活动区 -->
  162. <ul class="hd">
  163. <li class="item">
  164. <div class="box">
  165. <img src="static/images/tj/tj-1.jpg" alt="">
  166. <img src="static/images/sd/sd-1.jpg" alt="">
  167. <p>嗨购不止6折</p>
  168. <p>进口时尚</p>
  169. </div>
  170. </li>
  171. <li class="item">
  172. <div class="box">
  173. <img src="static/images/tj/tj-2.jpg" alt="">
  174. <img src="static/images/sd/sd-1.jpg" alt="">
  175. <p>赠限量野兽派</p>
  176. <p>潮礼送给他</p>
  177. </div>
  178. </li>
  179. <li class="item">
  180. <div class="box">
  181. <img src="static/images/tj/tj-3.jpg" alt="">
  182. <img src="static/images/sd/sd-1.jpg" alt="">
  183. <p>9.9元特惠</p>
  184. <p>京东汽车</p>
  185. </div>
  186. </li>
  187. <li class="item">
  188. <div class="box">
  189. <img src="static/images/tj/tj-4.jpg" alt="">
  190. <img src="static/images/sd/sd-1.jpg" alt="">
  191. <p>每满100减50</p>
  192. <p>图书圣诞购</p>
  193. </div>
  194. </li>
  195. </ul>
  196. <!-- 推荐区 -->
  197. <h2 class="title">猜你喜欢</h2>
  198. <ul class="tj">
  199. <li class="item">
  200. <a href=""><img src="static/images/sp/sp-1.webp" alt=""></a>
  201. <p>商品介绍</p>
  202. <div class="price">
  203. <div class="iconfont icon-rmb">203</div>
  204. <div>看相似</div>
  205. </div>
  206. </li>
  207. <li class="item">
  208. <a href=""><img src="static/images/sp/sp-2.webp" alt=""></a>
  209. <p>商品介绍</p>
  210. <div class="price">
  211. <div class="iconfont icon-rmb">203</div>
  212. <div>看相似</div>
  213. </div>
  214. </li>
  215. <li class="item">
  216. <a href=""><img src="static/images/sp/sp-3.webp" alt=""></a>
  217. <p>商品介绍</p>
  218. <div class="price">
  219. <div class="iconfont icon-rmb">203</div>
  220. <div>看相似</div>
  221. </div>
  222. </li>
  223. <li class="item">
  224. <a href=""><img src="static/images/sp/sp-4.webp" alt=""></a>
  225. <p>商品介绍</p>
  226. <div class="price">
  227. <div class="iconfont icon-rmb">203</div>
  228. <div>看相似</div>
  229. </div>
  230. </li>
  231. <li class="item">
  232. <a href=""><img src="static/images/sp/sp-5.webp" alt=""></a>
  233. <p>商品介绍</p>
  234. <div class="price">
  235. <div class="iconfont icon-rmb">203</div>
  236. <div>看相似</div>
  237. </div>
  238. </li>
  239. <li class="item">
  240. <a href=""><img src="static/images/sp/sp-6.webp" alt=""></a>
  241. <p>商品介绍</p>
  242. <div class="price">
  243. <div class="iconfont icon-rmb">203</div>
  244. <div>看相似</div>
  245. </div>
  246. </li>
  247. </ul>
  248. <!-- 声明区 -->
  249. <div class="sm">
  250. <p>本案例用于学习</p>
  251. </div>
  252. </div>
  253. <!-- 页脚 -->
  254. <div class="footer">
  255. <div>
  256. <div class="iconfont icon-home"></div>
  257. <span>分类</span>
  258. </div>
  259. <div>
  260. <div class="iconfont icon-layers"></div>
  261. <span>分类</span>
  262. </div>
  263. <div>
  264. <div class="iconfont icon-kehuguanli"></div>
  265. <span>京喜</span>
  266. </div>
  267. <div>
  268. <div class="iconfont icon-shopping-cart"></div>
  269. <span>购物车</span>
  270. </div>
  271. <div>
  272. <div class="iconfont icon-user"></div>
  273. <span>未登录</span>
  274. </div>
  275. </div>
  276. </body>
  277. </html>

reset.css

公共初始化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. }

index.css

首页css

  1. /* 导入公共初始化样式表 */
  2. @import 'reset.css';
  3. /* 页眉 */
  4. .header {
  5. /* 基础 */
  6. background-color: #c43130;
  7. color: white;
  8. height: 4.4rem;
  9. /* 固定定位 */
  10. position: fixed;
  11. top: 0;
  12. left: 0;
  13. right: 0;
  14. z-index: 100;
  15. font-size: 1.4rem;
  16. }
  17. /* 页脚 */
  18. .footer {
  19. /* 基础 */
  20. color: #666;
  21. background-color: #fafafa;
  22. box-shadow: 0 0 3px #999;
  23. height: 4.4rem;
  24. /* 固定定位 */
  25. position: fixed;
  26. bottom: 0;
  27. left: 0;
  28. right: 0;
  29. z-index: 100;
  30. font-size: 1.4rem;
  31. }
  32. /* 主体 */
  33. .main {
  34. /* 绝对定位 */
  35. position: absolute;
  36. top: 4.4rem;
  37. bottom: 4.4rem;
  38. left: 0;
  39. right: 0;
  40. /* background-color: yellow; */
  41. font-size: 1.4rem;
  42. }

header.css

页眉css

  1. .header {
  2. display: flex;
  3. align-items: center;
  4. }
  5. /* 页眉中的三个部分比例 1:6:1 */
  6. .header .login {
  7. color: #fff;
  8. flex: 1;
  9. text-align: center;
  10. }
  11. .header .menu {
  12. flex: 1;
  13. text-align: center;
  14. font-size: 2.5rem;
  15. }
  16. .header .search {
  17. flex: 6;
  18. padding: 0.5rem;
  19. background-color: #fff;
  20. border-radius: 3rem;
  21. display: flex;
  22. }
  23. /* logo */
  24. .header .search .logo {
  25. color: #e43130;
  26. flex: 0 1 4rem;
  27. font-size: 2rem;
  28. /* 水平垂直居中 */
  29. text-align: center;
  30. line-height: 2rem;
  31. }
  32. /* 放大镜 */
  33. .header .search .zoom {
  34. color: #ccc;
  35. flex: 0 1 4rem;
  36. border-left: 1px solid;
  37. /* 水平垂直居中 */
  38. text-align: center;
  39. line-height: 2rem;
  40. }
  41. /* 搜索文本框 */
  42. .header .search .words {
  43. flex: auto;
  44. border: none;
  45. outline: none;
  46. color: #aaa;
  47. }

页脚css

  1. .footer {
  2. display: flex;
  3. justify-content: space-around;
  4. }
  5. .footer > div {
  6. display: flex;
  7. flex-flow: column nowrap;
  8. align-items: center;
  9. }
  10. .footer > div > .iconfont {
  11. font-size: 2rem;
  12. }
  13. .footer > div >span {
  14. font-size: 1rem;
  15. }

banner.css

广告区css

  1. /* 广告区 */
  2. .main .banner {
  3. padding: 1rem 1rem;
  4. }
  5. .main .banner img {
  6. width: 100%;
  7. border-radius: 1rem;
  8. }

nav.css

导航css

  1. /* 主导航区 */
  2. .main .nav {
  3. /* background-color: #fff; */
  4. padding: 1rem;
  5. display: flex;
  6. /* 允许换行 */
  7. flex-flow: row wrap;
  8. }
  9. .main .nav img {
  10. height: 4rem;
  11. width: 4rem;
  12. }
  13. .main .nav li {
  14. /* 每一行显示5个,按100%来分配,应该是20% */
  15. flex: 1 1 20%;
  16. display: flex;
  17. flex-flow: column nowrap;
  18. align-items: center;
  19. }

ms.css

秒杀css

  1. /* 秒杀 */
  2. .main .ms {
  3. background-color: #fff;
  4. padding: 1rem;
  5. margin: 1rem;
  6. }
  7. .main .ms .ms-top {
  8. font-size: 1.3rem;
  9. height: 3rem;
  10. display: flex;
  11. justify-content: space-between;
  12. }
  13. .main .ms .ms-top .left {
  14. display: flex;
  15. }
  16. .main .ms .ms-top .left .notice{
  17. font-size: 1.1rem;
  18. height: 2rem;
  19. border: 1px solid #e43130;
  20. border-radius: 1rem;
  21. margin-left: 1rem;
  22. display: flex;
  23. justify-content: center;
  24. align-items: center;
  25. }
  26. .main .ms .ms-top .left .notice .tips{
  27. background-color: #e43130;
  28. color: #fff;
  29. border-radius: 1rem;
  30. padding: 0.3rem 0.5rem;
  31. }
  32. .main .ms .ms-top .left .notice .time{
  33. padding: 0.3rem 0.5rem;
  34. }
  35. .main .ms .ms-top .right{
  36. color: #e43130;
  37. }
  38. /* 主体区 */
  39. .main .ms .ms-body{
  40. display: flex;
  41. justify-content: space-between;
  42. }
  43. .main .ms .ms-body li {
  44. /* 每一行显示5个,按100%来分配,应该是20% */
  45. flex: 1 1 20%;
  46. display: flex;
  47. flex-flow: column nowrap;
  48. align-items: center;
  49. }
  50. .main .ms .ms-body img{
  51. height: 8rem;
  52. width: 8rem;
  53. }
  54. /* 秒杀价 */
  55. .main .ms .ms-body .item div:first-of-type{
  56. color: #e43130;
  57. font-weight: bolder;
  58. }
  59. /* 原价 */
  60. .main .ms .ms-body .item div:last-of-type{
  61. color: #666;
  62. text-decoration: line-through;
  63. text-decoration-color: #666;
  64. }

hd.css

活动css

  1. /* 活动 */
  2. .main .hd {
  3. background-color: #fff;
  4. padding: 1rem;
  5. display: flex;
  6. }
  7. .main .hd .item {
  8. height: 12rem;
  9. /* 每一行显示5个,按100%来分配,应该是25% */
  10. flex: 1 1 25%;
  11. }
  12. .main .hd .item .box {
  13. /* 绝对定位 */
  14. position: absolute;
  15. }
  16. .main .hd .item img:first-of-type {
  17. width: 6rem;
  18. /* 绝对定位 */
  19. position: absolute;
  20. top: 0.5rem;
  21. bottom: 0rem;
  22. left: 1rem;
  23. right: 0;
  24. }
  25. .main .hd .item img:last-of-type {
  26. width: 8rem;
  27. /* 绝对定位 */
  28. position: absolute;
  29. top: 0rem;
  30. bottom: 0rem;
  31. left: 0;
  32. right: 0;
  33. }
  34. .main .hd .item p:first-of-type {
  35. width: 8rem;
  36. font-size: 0.8rem;
  37. font-weight: bolder;
  38. text-align: center;
  39. color: white;
  40. /* 绝对定位 */
  41. position: absolute;
  42. top: 6.8rem;
  43. bottom: 0rem;
  44. left: 0rem;
  45. right: 0;
  46. }
  47. .main .hd .item p:last-of-type {
  48. width: 8rem;
  49. font-size: 1rem;
  50. font-weight: bolder;
  51. text-align: center;
  52. color: white;
  53. /* 绝对定位 */
  54. position: absolute;
  55. top: 9rem;
  56. bottom: 0rem;
  57. left: 0rem;
  58. right: 0;
  59. }

tj.css

推荐css

  1. /* 推荐区 */
  2. .main .title {
  3. height: 4rem;
  4. color: #555;
  5. font-weight: 500;
  6. text-align: center;
  7. }
  8. .main .tj {
  9. font-size: 1rem;
  10. display: flex;
  11. /* 允许换行 */
  12. flex-wrap: wrap;
  13. }
  14. .main .tj .item {
  15. flex: 1 1 calc(50% - 2rem);
  16. background-color: #fff;
  17. overflow: hidden;
  18. display: flex;
  19. flex-flow: column nowrap;
  20. margin-left: 1rem;
  21. margin-bottom: 1rem;
  22. padding-bottom: 1rem;
  23. border-radius: 1rem;
  24. }
  25. .main .tj .item img{
  26. width: 100%;
  27. height: 100%;
  28. }
  29. .main .tj .item .price {
  30. display: flex;
  31. justify-content: space-between;
  32. }
  33. .main .tj .item .price div:first-of-type {
  34. color: red;
  35. }
  36. .main .tj .item .price div:last-of-type {
  37. color: #666;
  38. background-color: #f6f6f6;
  39. border-radius: 1rem;
  40. padding: 0.2rem 1rem;
  41. }

zp.css

正品直邮区css

  1. .main .zp {
  2. background-color: #fff;
  3. padding: 1rem;
  4. display: flex;
  5. }
  6. .main .zp .item {
  7. padding: 1rem;
  8. /* 每一行显示5个,按100%来分配,应该是25% */
  9. flex: 1 1 25%;
  10. display: flex;
  11. flex-flow: column wrap;
  12. justify-content: space-between;
  13. align-items: flex-start;
  14. }
  15. /* 标题 */
  16. .main .zp .item .title {
  17. height: 4rem;
  18. display: flex;
  19. flex-flow: column wrap;
  20. justify-content: flex-end;
  21. }
  22. .main .zp .item .title a:first-of-type{
  23. color: black;
  24. font-weight: bolder;
  25. }
  26. .main .zp .item .title a:last-of-type{
  27. color: #666;
  28. }
  29. .main .zp .item img{
  30. width: 8rem;
  31. height: 8rem;
  32. }

sm.css

声明区css

  1. /* 声明区 */
  2. .main .sm {
  3. height: 10rem;
  4. }

效果图1

效果图2

效果图3

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议