博客列表 >1月1日元旦作业

1月1日元旦作业

-   迷舍人
- 迷舍人原创
2020年01月02日 23:22:18542浏览

总结:其实原来12.31晚上就做出来了,但是主体和头部 都用的分散对齐 然后购物车里面和上面不对称 ,忘记用position: relative;进行定位微调了,我还以为这样微调了会影响什么就是一种担心,现在老师一讲就明白了 ,能达到自己想要的效果就行!

效果图-购物车

购物车 html代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>购物车</title>
  6. <link rel="stylesheet" href="gouwuche.css">
  7. </head>
  8. <body>
  9. <div class="shopping">
  10. <h3>购物车</h3>
  11. <header>
  12. <span>
  13. <input type="checkbox" name="checked" id="checked" checked>
  14. <label for="checked">全选</label>
  15. </span>
  16. <span>商品</span>
  17. <span>单价</span>
  18. <span>数量</span>
  19. <span>小计</span>
  20. <span>操作</span>
  21. </header>
  22. <main>
  23. <div class="main-top">
  24. <span>
  25. <input type="checkbox" checked>
  26. </span>
  27. <div>
  28. <span>
  29. <a href="">
  30. <img src="static/images/shop/10.jpg" alt="">
  31. </a>
  32. <a href="">【送国检一对一证书佛级手串佛珠念珠木饰男款水</a>
  33. </span>
  34. </div>
  35. <span><i>&yen</i>888</span>
  36. <span>
  37. <input type="number" name="count" value="1" min="1">
  38. </span>
  39. <span><i>&yen;</i>888</span>
  40. <span>
  41. <a href="">删除</a>
  42. </span>
  43. </div>
  44. <div class="main-top">
  45. <span>
  46. <input type="checkbox" checked>
  47. </span>
  48. <div>
  49. <span>
  50. <a href="">
  51. <img src="static/images/shop/10.jpg" alt="">
  52. </a>
  53. <a href="">【送国检一对一证书佛级手串佛珠念珠木饰男款水</a>
  54. </span>
  55. </div>
  56. <span><i>&yen</i>888</span>
  57. <span>
  58. <input type="number" name="count" value="1" min="1">
  59. </span>
  60. <span><i>&yen;</i>888</span>
  61. <span>
  62. <a href="">删除</a>
  63. </span>
  64. </div>
  65. <div class="main-top">
  66. <span>
  67. <input type="checkbox" checked>
  68. </span>
  69. <div>
  70. <span>
  71. <a href="">
  72. <img src="static/images/shop/10.jpg" alt="">
  73. </a>
  74. <a href="">【送国检一对一证书佛级手串佛珠念珠木饰男款水</a>
  75. </span>
  76. </div>
  77. <span><i>&yen</i>888</span>
  78. <span>
  79. <input type="number" name="count" value="1" min="1">
  80. </span>
  81. <span><i>&yen;</i>888</span>
  82. <span>
  83. <a href="">删除</a>
  84. </span>
  85. </div>
  86. <div class="main-top">
  87. <span>
  88. <input type="checkbox" checked>
  89. </span>
  90. <div>
  91. <span>
  92. <a href="">
  93. <img src="static/images/shop/10.jpg" alt="">
  94. </a>
  95. <a href="">【送国检一对一证书佛级手串佛珠念珠木饰男款水</a>
  96. </span>
  97. </div>
  98. <span><i>&yen</i>888</span>
  99. <span>
  100. <input type="number" name="count" value="1" min="1">
  101. </span>
  102. <span><i>&yen;</i>888</span>
  103. <span>
  104. <a href="">删除</a>
  105. </span>
  106. </div>
  107. </main>
  108. <footer>
  109. <span>数量:<i>1</i></span>
  110. <span>金额<i>888.00</i></span>
  111. <button>去结算</button>
  112. </footer>
  113. </div>
  114. </body>
  115. </html>

购物车 css

  1. /*引入公共样式*/
  2. @import "public_teset.css";
  3. .shopping{
  4. width: 1200px;
  5. background-color: #fff;
  6. margin: 20px auto;
  7. }
  8. .shopping > h3{
  9. height: 48px;
  10. display: flex;
  11. justify-content: center;
  12. align-items: center;
  13. font-size: 1.5rem;
  14. color: red;
  15. }
  16. /*头部*/
  17. .shopping > header{
  18. height: 48px;
  19. display: flex;
  20. justify-content: space-around;
  21. align-items: center;
  22. background-color: #666666;
  23. }
  24. /*内容*/
  25. .shopping > main{
  26. margin: 10px 0;
  27. }
  28. .shopping > main > .main-top{
  29. height: 80px;
  30. display: flex;
  31. flex-direction: row;
  32. justify-content: space-around;
  33. align-items: center;
  34. border-bottom: 1px #c6c6c6 solid;
  35. box-sizing: border-box;
  36. }
  37. .shopping > main > .main-top > div > span:first-of-type{
  38. display: flex;
  39. align-items: center;
  40. width: 300px;
  41. }
  42. .shopping > main > .main-top > div > span:first-of-type > a > img{
  43. height: 60px;
  44. width: 70px;
  45. }
  46. .shopping > main > .main-top > span:first-of-type{
  47. position: relative;
  48. margin-left: 4px;
  49. }
  50. .shopping > main > .main-top > div > span{
  51. position: relative;
  52. margin-left: -130px;
  53. }
  54. .shopping > main > .main-top > span:nth-of-type(2){
  55. position: relative;
  56. margin-left: -100px;
  57. }
  58. .shopping > main > .main-top > span:nth-of-type(3){
  59. position: relative;
  60. margin-left: -10px;
  61. }
  62. .shopping > main > .main-top > span:nth-of-type(3) > input{
  63. width: 70px;
  64. height: 20px;
  65. }
  66. .shopping > main > .main-top > span:nth-of-type(4){
  67. position: relative;
  68. margin-left: -20px;
  69. }
  70. /*尾部*/
  71. .shopping > footer{
  72. height: 50px;
  73. display: flex;
  74. justify-content: flex-end;
  75. align-items: center;
  76. }
  77. .shopping > footer > *:not(button){
  78. /*width: 70px;*/
  79. margin-right: 20px;
  80. }
  81. .shopping > footer > button{
  82. border: none;
  83. background-color: #bd2c00;
  84. color: white;
  85. width: 60px;
  86. height: 40px;
  87. margin-right: 10px;
  88. }
  89. .shopping > footer > button:hover{
  90. background-color: #0086b3;
  91. cursor: pointer;
  92. }

结算页效果图

结算页html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>结算页面</title>
  6. <link rel="stylesheet" href="jiesuan.css">
  7. </head>
  8. <body>
  9. <div class="content">
  10. <div class="nav">
  11. <!--头部logo-->
  12. <div class="top">
  13. <a href="">
  14. <img src="https://misc.360buyimg.com/jdf/1.0.0/unit/global-header/5.0.0/i/jdlogo-201708-@2x.png" alt="">
  15. </a>
  16. <span>结算页</span>
  17. </div>
  18. <h3>填写并核对订单信息</h3>
  19. <!--内容-->
  20. <div class="main">
  21. <div class="main-top">
  22. <h3>收货人信息</h3>
  23. <a href="">新增收货地址</a>
  24. </div>
  25. <div class="nav">
  26. <span>程序员 山东 济南市 突然县我发镇 稍等村 184****6039 </span>
  27. <span>默认地址</span>
  28. <a href="">编辑</a>
  29. </div>
  30. </div>
  31. <div class="sk">
  32. <h3>支付方式</h3>
  33. <div class="fs">
  34. <span>货到付款</span>
  35. <span>在线支付</span>
  36. <a href="">更多》</a>
  37. </div>
  38. </div>
  39. <div class="pay">
  40. <div class="jine">
  41. <span>应付总额:</span>
  42. <span>¥11497.00</span>
  43. </div>
  44. <div class="dizhi">
  45. <span>寄送至: 山东 稍等市 稍等县 稍等镇 稍等村</span>
  46. <span> 收货人:稍等 184****6039</span>
  47. </div>
  48. </div>
  49. <div class="tijiao">
  50. <button>提交</button>
  51. </div>
  52. </div>
  53. </div>
  54. </body>
  55. </html>

结算页面css

  1. /*引入公共样式*/
  2. @import "public_teset.css";
  3. .content{
  4. margin: 20px;
  5. background-color: white;
  6. }
  7. .content > .nav{
  8. width: 1200px;
  9. margin: auto;
  10. display: flex;
  11. flex-direction: column;
  12. }
  13. .content > .nav > .top{
  14. height: 100px;
  15. width: 400px;
  16. display: flex;
  17. flex-direction: row;
  18. }
  19. .content > .nav > .top > span{
  20. font-size: 19px;
  21. align-self: center;
  22. margin: 0 10px;
  23. }
  24. .content > .nav > .top > a {
  25. display: flex;
  26. flex-direction: column;
  27. justify-content: center;
  28. }
  29. .content > .nav > .top > a > img{
  30. height: 42px;
  31. width: 134px;
  32. align-self: flex-end;
  33. }
  34. .content > .nav > h3{
  35. color: #666666;
  36. }
  37. .content > .nav > .main{
  38. border: 1px solid #888888;
  39. box-sizing: border-box;
  40. }
  41. .content > .nav > .main > .main-top{
  42. height: 38px;
  43. line-height: 38px;
  44. display: flex;
  45. justify-content: space-between;
  46. }
  47. .content > .nav > .main > .nav{
  48. height: 100px;
  49. display: flex;
  50. align-items: center;
  51. justify-content: space-around;
  52. }
  53. .content > .nav > .main > .nav > span:last-of-type{
  54. background-color: #888888;
  55. }
  56. .content > .nav > .main > .nav > a:hover{
  57. color: red;
  58. }
  59. .content > .nav > .sk{
  60. height: 100px;
  61. border: 1px solid #888888;
  62. margin-top: 3px;
  63. box-sizing: border-box;
  64. }
  65. .content > .nav > .sk > h3{
  66. height: 38px;
  67. line-height: 38px;
  68. }
  69. .content > .nav > .sk > .fs{
  70. width: 300px;
  71. line-height: 50px;
  72. display: flex;
  73. justify-content: space-around;
  74. }
  75. .content > .nav > .sk > .fs > span:hover,a:hover{
  76. cursor: pointer;
  77. }
  78. .content > .nav > .pay{
  79. height: 80px;
  80. display: flex;
  81. flex-direction: column;
  82. }
  83. .content > .nav > .pay > .jine{
  84. height: 40px;
  85. line-height: 40px;
  86. display: flex;
  87. justify-content: flex-end;
  88. }
  89. .content > .nav > .pay > .jine > span:last-of-type{
  90. color: red;
  91. font-size: 18px;
  92. }
  93. .content > .nav > .pay > .dizhi{
  94. height: 40px;
  95. line-height: 40px;
  96. display: flex;
  97. justify-content: flex-end;
  98. }
  99. .content > .nav > .pay > .dizhi > span:first-of-type{
  100. color: #999;
  101. }
  102. .content > .nav > .pay > .dizhi > span:last-of-type{
  103. color: #999;
  104. margin-left: 10px;
  105. }
  106. .content > .nav > .tijiao{
  107. height: 50px;
  108. display: flex;
  109. justify-content: flex-end;
  110. }
  111. .content > .nav > .tijiao > button{
  112. width: 70px;
  113. height: 38px;
  114. background-color: red;
  115. border: none;
  116. box-sizing: border-box;
  117. color: white;
  118. }
  119. .content > .nav > .tijiao > button:hover{
  120. cursor: pointer;
  121. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议