博客列表 >仿写京东商城

仿写京东商城

手机用户1615433136
手机用户1615433136原创
2021年03月27日 21:05:19721浏览

京东商城

<!DOCTYPE html>

<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>京东商城/title>
<!-- 字体图标 -->
<link rel="stylesheet" href="static/icon-font/iconfont.css" />
<!-- 首页 -->
<link rel="stylesheet" href="static/css/index.css" />
<!-- 页眉区 -->
<link rel="stylesheet" href="static/css/header.css" />
<!-- 导航区 -->
<link rel="stylesheet" href="static/css/nav.css" />
<!-- 秒杀 -->
<link rel="stylesheet" href="static/css/ms.css" />
<!-- 推荐:猜你喜欢 -->
<link rel="stylesheet" href="static/css/tj.css" />
<!-- 页脚 -->
<link rel="stylesheet" href="static/css/footer.css" />
</head>

  1. <body>
  2. <!-- 页眉 -->
  3. <div class="header">
  4. <!-- 字体图标菜单 -->
  5. <div class="menu iconfont icon-menu"></div>
  6. <!-- 搜索框 -->
  7. <div class="search">
  8. <div class="logo">JD</div>
  9. <div class="zoom iconfont icon-search"></div>
  10. <input class="words" type="text" value="牛奶" />
  11. </div>
  12. <!-- 登录按钮 -->
  13. <a href="" class="login">登录</a>
  14. </div>

主体

<div class="main">

主导航区

<ul class="nav">

第一组

  1. <li>
  2. <a href=""><img src="static/images/dh/nav-1.png" alt="" /></a>
  3. <a href="">京东超市</a>
  4. </li>
  5. <li>
  6. <a href=""><img src="static/images/dh/nav-2.png" alt="" /></a>
  7. <a href="">数码电器</a>
  8. </li>
  9. <li>
  10. <a href=""><img src="static/images/dh/nav-3.png" alt="" /></a>
  11. <a href="">京东服饰</a>
  12. </li>
  13. <li>
  14. <a href=""><img src="static/images/dh/nav-4.png" alt="" /></a>
  15. <a href="">京东生鲜</a>
  16. </li>
  17. <li>
  18. <a href=""><img src="static/images/dh/nav-5.png" alt="" /></a>
  19. <a href="">京东到家</a>
  20. </li>

第二组

  1. <li>
  2. <a href=""><img src="static/images/dh/nav-6.png" alt="" /></a>
  3. <a href="">充值缴费</a>
  4. </li>
  5. <li>
  6. <a href=""><img src="static/images/dh/nav-7.png" alt="" /></a>
  7. <a href="">9.9元拼</a>
  8. </li>
  9. <li>
  10. <a href=""><img src="static/images/dh/nav-8.png" alt="" /></a>
  11. <a href="">领券</a>
  12. </li>
  13. <li>
  14. <a href=""><img src="static/images/dh/nav-9.png" alt="" /></a>
  15. <a href="">领金贴</a>
  16. </li>
  17. <li>
  18. <a href=""><img src="static/images/dh/nav-10.png" alt="" /></a>
  19. <a href="">PLUS会员</a>
  20. </li>
  21. </ul>

秒杀区

  • 头部
    1. <div class="ms-top">
    2. <div class="left">
    3. <div class="title">京东秒杀</div>
    4. <div class="notice">
    5. <div class="tips">18点专场</div>
    6. <div class="time">02:20:30</div>
    7. </div>
    8. </div>
    9. <div class="right">更多秒杀</div>
    10. </div>

秒杀主体区

  1. <ul class="ms-body">
  2. <li class="item">
  3. <a href=""><img src="images/ms/ms-1.jpg" alt="" /></a>
  4. <div class="iconfont icon-rmb">338</div>
  5. <div class="iconfont icon-rmb">558</div>
  6. </li>
  7. <li class="item">
  8. <a href=""><img src="images/ms/ms-2.jpg" alt="" /></a>
  9. <div class="iconfont icon-rmb">3456</div>
  10. <div class="iconfont icon-rmb">4567</div>
  11. </li>
  12. <li class="item">
  13. <a href=""><img src="mages/ms/ms-3.jpg" alt="" /></a>
  14. <div class="iconfont icon-rmb">789</div>
  15. <div class="iconfont icon-rmb">999</div>
  16. </li>
  17. <li class="item">
  18. <a href=""><img src="images/ms/ms-4.jpg" alt="" /></a>
  19. <div class="iconfont icon-rmb">3213</div>
  20. <div class="iconfont icon-rmb">4532</div>
  21. </li>
  22. </ul>
  23. </div>
  24. <!-- 推荐区 -->
  25. <h2 class="title">猜你喜欢</h2>
  26. <ul class="tj">
  27. <li class="item">
  28. <a href=""><img src="images/sp/sp-1.webp" alt="" /></a>
  29. <p>商品详情商品介绍商品规格</p>
  30. <div class="price">
  31. <div class="iconfont icon-rmb">203</div>
  32. <div>看相似</div>
  33. </div>
  34. </li>
  35. <li class="item">
  36. <a href=""><img src="images/sp/sp-2.webp" alt="" /></a>
  37. <p>商品详情商品介绍商品规格</p>
  38. <div class="price">
  39. <div class="iconfont icon-rmb">203</div>
  40. <div>看相似</div>
  41. </div>
  42. </li>
  43. <li class="item">
  44. <a href=""><img src="images/sp/sp-3.webp" alt="" /></a>
  45. <p>商品详情商品介绍商品规格</p>
  46. <div class="price">
  47. <div class="iconfont icon-rmb">203</div>
  48. <div>看相似</div>
  49. </div>
  50. </li>
  51. <li class="item">
  52. <a href=""><img src="images/sp/sp-4.webp" alt="" /></a>
  53. <p>商品详情商品介绍商品规格</p>
  54. <div class="price">
  55. <div class="iconfont icon-rmb">203</div>
  56. <div>看相似</div>
  57. </div>
  58. </li>
  59. <li class="item">
  60. <a href=""><img src="images/sp/sp-5.webp" alt="" /></a>
  61. <p>商品详情商品介绍商品规格</p>
  62. <div class="price">
  63. <div class="iconfont icon-rmb">203</div>
  64. <div>看相似</div>
  65. </div>
  66. </li>
  67. <li class="item">
  68. <a href=""><img src="mages/sp/sp-6.webp" alt="" /></a>
  69. <p>商品详情商品介绍商品规格</p>
  70. <div class="price">
  71. <div class="iconfont icon-rmb">203</div>
  72. <div>看相似</div>
  73. </div>
  74. </li>
  75. </ul>
  76. </div>
  77. <!-- 页脚 -->
  78. <div class="footer">
  79. <div>
  80. <div class="iconfont icon-home"></div>
  81. <span>主页</span>
  82. </div>
  83. <div>
  84. <div class="iconfont icon-layers"></div>
  85. <span>分类</span>
  86. </div>
  87. <div>
  88. <div class="iconfont icon-kehuguanli"></div>
  89. <span>京喜</span>
  90. </div>
  91. <div>
  92. <div class="iconfont icon-shopping-cart"></div>
  93. <span>购物车</span>
  94. </div>
  95. <div>
  96. <div class="iconfont icon-user"></div>
  97. <span>未登录</span>
  98. </div>
  99. </div>
  100. </body>
  101. </html>
  1. .footer {
  2. display: flex;
  3. justify-content: space-around;
  4. align-items: center;
  5. }
  6. .footer > div {
  7. display: flex;
  8. flex-flow: column nowrap;
  9. align-items: center;
  10. }
  11. .footer > div > .iconfont {
  12. font-size: 2rem;
  13. }
  14. .footer > div > span {
  15. font-size: 1rem;
  16. }

header.css

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

index.css

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

ms.css

  1. /* 秒杀 */
  2. .main .ms {
  3. background-color: #fff;
  4. padding: 1rem;
  5. margin: 1rem 0;
  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: 2rem;
  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: 2rem;
  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 img {
  44. height: 12rem;
  45. width: 12rem;
  46. }
  47. /* 秒杀价 */
  48. .main .ms .ms-body .item div:first-of-type {
  49. color: #e43130;
  50. font-weight: bolder;
  51. }
  52. /* 原价 */
  53. .main .ms .ms-body .item div:last-of-type {
  54. color: #666666;
  55. text-decoration: line-through;
  56. text-decoration-color: #666666;
  57. }

nav.css

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

reset.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. }

tj.css

  1. .main .title {
  2. height: 4rem;
  3. color: #555;
  4. font-weight: 500;
  5. text-align: center;
  6. }
  7. .main .tj {
  8. font-size: 1rem;
  9. display: flex;
  10. /* 允许换行 */
  11. flex-wrap: wrap;
  12. }
  13. .main .tj .item {
  14. flex: 1 1 calc(50% - 2rem);
  15. background-color: #fff;
  16. overflow: hidden;
  17. display: flex;
  18. flex-flow: column nowrap;
  19. margin-left: 1rem;
  20. margin-bottom: 1rem;
  21. padding-bottom: 1rem;
  22. border-radius: 1rem;
  23. }
  24. .main .tj .item img {
  25. width: 100%;
  26. height: 100%;
  27. }
  28. .main .tj .item {
  29. padding: 1rem;
  30. }
  31. .main .tj .item .price {
  32. display: flex;
  33. justify-content: space-between;
  34. }
  35. .main .tj .item .price div:first-of-type {
  36. color: red;
  37. }
  38. .main .tj .item .price div:last-of-type {
  39. color: #666;
  40. background-color: #f6f6f6;
  41. border-radius: 1rem;
  42. padding: 0.2rem 1rem;
  43. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议