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

京东app页眉-推荐-页脚制作

程序员文章站 2022-03-03 23:41:19
...

京东app页眉-推荐-页脚制作

作业内容:京东app首页,选择导航,页眉,页脚,秒杀,推荐等,任选二个组件完成即可

  • 页眉,推荐,页脚代码
  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>JD home</title>
  7. <link rel="stylesheet" href="static/css/jd.css">
  8. </head>
  9. <body>
  10. <!-- 页眉 -->
  11. <header>
  12. <!-- 导航图标 -->
  13. <div class="menu iconfont icon-daohang"></div>
  14. <!-- 中间搜索框 -->
  15. <div class="search">
  16. <div class="logo">JD</div>
  17. <div class="zoom iconfont icon-sousuo"></div>
  18. <input class="words" type="text" name="search" value="超薄本" />
  19. </div>
  20. <!-- 登录链接 -->
  21. <div class="login"><a href="">登录</a></div>
  22. </header>
  23. <!-- 主体 -->
  24. <main>
  25. <h2>猜你喜欢</h2>
  26. <ul>
  27. <li class="item">
  28. <a href=""><img
  29. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/118759/27/18140/174299/5f639d55Eff2fb460/f0a383120faa5213.jpg!q70.dpg.webp"
  30. alt=""></a>
  31. <p>100支长绒棉欧式北欧风轻奢四件套全棉纯棉床单床笠被套酒店三件套床上用品4 梦蓝银灰 1.8m床单款四件套(被套200*230cm)</p>
  32. <div class="price">
  33. <div>¥ 498</div>
  34. <div>看相似</div>
  35. </div>
  36. </li>
  37. <li class="item">
  38. <a href=""><img
  39. src="https://img13.360buyimg.com/mobilecms/s372x372_jfs/t1/148010/28/8733/166712/5f65b4c5E8506b16c/71f1adfb1a49b10f.jpg!q70.dpg.webp"
  40. alt=""></a>
  41. <p>超媛加绒加厚中长款打底衫女冬季新款显瘦大码女装上衣立领外穿连衣裙FF-A015-C#9916你 黑色 S</p>
  42. <div class="price">
  43. <div>¥ 498</div>
  44. <div>看相似</div>
  45. </div>
  46. </li>
  47. <li class="item">
  48. <a href=""><img
  49. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/150600/39/11576/322314/5fdf806bE968752a7/e96be941acbffd20.jpg!q70.dpg.webp"
  50. alt=""></a>
  51. <p>芬腾 保暖内衣女士套装秋衣秋裤秋冬季新品棉质修身圆领少女棉毛衫长袖长裤打底衫女 浅紫(蕾丝领) M </p>
  52. <div class="price">
  53. <div>¥ 498</div>
  54. <div>看相似</div>
  55. </div>
  56. </li>
  57. <li class="item">
  58. <a href=""><img
  59. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/135532/8/9634/253738/5f59df91Ec8d59432/dafe418dc6f75762.jpg!q70.dpg.webp"
  60. alt=""></a>
  61. <p>@潮牌许刘芒1970s紫外线变色高帮手绘帆布鞋女2020春秋款百搭ulzzang日系女生板鞋 黑色(高 帮款,阳光下变色时效8小时) 39</p>
  62. <div class="price">
  63. <div>¥ 498</div>
  64. <div>看相似</div>
  65. </div>
  66. </li>
  67. </ul>
  68. </main>
  69. <!-- 页脚 -->
  70. <footer>
  71. <div>
  72. <div class="iconfont icon-shouye"></div>
  73. <span>主页</span>
  74. </div>
  75. <div>
  76. <div class="iconfont icon-fenlei"></div>
  77. <span>分类</span>
  78. </div>
  79. <div>
  80. <div class="iconfont icon-jingxi"></div>
  81. <span>京喜</span>
  82. </div>
  83. <div>
  84. <div class="iconfont icon-gouwuche-01"></div>
  85. <span>购物车</span>
  86. </div>
  87. <div>
  88. <div class="iconfont icon-denglu"></div>
  89. <span>未登录</span>
  90. </div>
  91. </footer>
  92. </body>
  93. </html>
  • 引入的 static/css/jd.css 样式
  1. /* 导入初始化 css */
  2. @import 'reset.css';
  3. /*
  4. 导入7个字体图标
  5. icon-shouye 首页
  6. icon-gouwuche-01 购物车
  7. icon-daohang 导航
  8. icon-denglu 登录
  9. icon-fenlei 分类
  10. icon-jingxi 惊喜
  11. icon-sousuo 搜索
  12. */
  13. @import '//at.alicdn.com/t/font_2289282_a45l8mmz4j.css';
  14. /* 页眉 */
  15. header {
  16. position: fixed;
  17. top: 0;
  18. left: 0;
  19. right: 0;
  20. background-color: red;
  21. height: 4rem;
  22. /* flex 容器 */
  23. display: flex;
  24. /* 交叉轴居中 */
  25. align-items: center;
  26. z-index: 100;
  27. }
  28. /* 左边菜单按钮 */
  29. header .menu {
  30. flex: 1;
  31. text-align: center;
  32. color: white;
  33. }
  34. /* 中间搜索框 */
  35. header .search {
  36. flex: 6;
  37. display: flex;
  38. align-items: center;
  39. border-radius: 2em;
  40. background-color: white;
  41. height: 2.5rem;
  42. }
  43. /* logo */
  44. header .search .logo {
  45. color: red;
  46. flex: 0 1 2em;
  47. font-size: 1.5rem;
  48. text-align: center;
  49. }
  50. /* 搜索图标 */
  51. header .search .zoom {
  52. flex: 0 1 2em;
  53. text-align: center;
  54. border-left: 1px solid #ccc;
  55. }
  56. /* 输入框 */
  57. header .search .words {
  58. border: none;
  59. outline: none;
  60. color: #bbb;
  61. }
  62. /* 右边登录链接 */
  63. header .login {
  64. flex: 1;
  65. text-align: center;
  66. }
  67. header .login a{
  68. color: white;
  69. font-size: 1.2rem;
  70. }
  71. /* 主体 */
  72. main {
  73. position: absolute;
  74. top: 4rem;
  75. left: 0;
  76. reight: 0;
  77. bottom: 4.5rem;
  78. }
  79. main h2 {
  80. text-align: center;
  81. margin: .5em 0;
  82. }
  83. main ul {
  84. /* 转flex容器 */
  85. display: flex;
  86. /* 主轴横向,交叉轴换行 */
  87. flex-flow: row wrap;
  88. }
  89. main ul .item {
  90. flex: 1 1 50%;
  91. padding: .5em;
  92. }
  93. main ul .item a img {
  94. width: 100%;
  95. }
  96. main ul .item p {
  97. font-size: 1.25rem;
  98. margin:.4em 0;
  99. }
  100. main ul .item .price {
  101. display: flex;
  102. /* 两端对齐 */
  103. justify-content: space-between;
  104. }
  105. main ul .item .price div:first-of-type {
  106. color:red;
  107. font-size: 1.4rem;
  108. }
  109. main ul .item .price div:last-of-type {
  110. background-color: #ddd;
  111. border-radius: 1em;
  112. padding: .5em;
  113. }
  114. /* 页脚 */
  115. footer {
  116. position: fixed;
  117. bottom: 0;
  118. left: 0;
  119. right: 0;
  120. height: 4.5rem;
  121. background-color: #eee;
  122. /* 转flex容器 */
  123. display: flex;
  124. /* 分散对齐 */
  125. justify-content: space-around;
  126. /* 交叉轴居中 */
  127. align-items: center;
  128. }
  129. footer > div {
  130. /* 将flex容器项目居中 */
  131. display: flex;
  132. flex-flow: column nowrap;
  133. align-items: center;
  134. }
  • 导入的 reset.css 样式是默认的
  1. /* reset 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. /* 媒体查询 */
  21. @media screen and (min-width: 480px) {
  22. html {
  23. font-size: 12px;
  24. }
  25. }
  26. @media screen and (min-width: 640px) {
  27. html {
  28. font-size: 14px;
  29. }
  30. }
  31. @media screen and (min-width: 720px) {
  32. html {
  33. font-size: 16px;
  34. }
  35. }
  • 导入的阿里 iconfont 7 个字体图标

链接为 https://at.alicdn.com/t/font_2289282_a45l8mmz4j.css

  • 附上制作图

京东app页眉-推荐-页脚制作