博客列表 >前端实践购物车、结算页-PHP培训十期线上班 学号:510251 01月01日作业

前端实践购物车、结算页-PHP培训十期线上班 学号:510251 01月01日作业

赵大叔
赵大叔原创
2020年01月03日 19:00:41818浏览

购物车、结算页

一、购物车

html代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>商城系统购物车</title>
  6. <link rel="stylesheet" href="shop_shopping_cart.css">
  7. </head>
  8. <body>
  9. <!--引用public-header代码-->
  10. <nav class="public-header">
  11. <a href="">网站首页</a>
  12. <a href="">专题</a>
  13. <a href="">网站导航</a>
  14. <a href="">二手商品</a>
  15. <a href="">讨论区</a>
  16. <span>
  17. <a href=""><i class="iconfont icon-huiyuan2"></i>登陆</a>
  18. <a href="">免费注册</a>
  19. </span>
  20. </nav>
  21. <!--购物车-->
  22. <div class="shop-shopping-cart">
  23. <h3>我的购物车</h3>
  24. <header>
  25. <span>
  26. <input type="checkbox" id="all-selected" checked>
  27. <label for="all-selected">全选</label>
  28. </span>
  29. <span>商品</span>
  30. <span>单价</span>
  31. <span>数量</span>
  32. <span>小计</span>
  33. <span>操作</span>
  34. </header>
  35. <main>
  36. <div>
  37. <span>
  38. <label><input type="checkbox" name="count" value="1" min="1"></label>
  39. </span>
  40. <span class="pic-intro">
  41. <a href=""><img src="static/images/111.jpg" alt=""></a>
  42. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  43. </span>
  44. <span><i>&yen;</i>179.00</span>
  45. <span>
  46. <label><input type="number" name="choose" checked></label>
  47. </span>
  48. <span><i>&yen;</i>179.00</span>
  49. <span>
  50. <a href="">删除</a>
  51. <a href="">移到我的关注</a>
  52. </span>
  53. </div>
  54. <div>
  55. <span>
  56. <label><input type="checkbox" name="count" value="1" min="1"></label>
  57. </span>
  58. <span class="pic-intro">
  59. <a href=""><img src="static/images/1111.jpg" alt=""></a>
  60. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  61. </span>
  62. <span><i>&yen;</i>179.00</span>
  63. <span>
  64. <label><input type="number" name="choose" checked></label>
  65. </span>
  66. <span><i>&yen;</i>179.00</span>
  67. <span>
  68. <a href="">删除</a>
  69. <a href="">移到我的关注</a>
  70. </span>
  71. </div>
  72. <div>
  73. <span>
  74. <label><input type="checkbox" name="count" value="1" min="1"></label>
  75. </span>
  76. <span class="pic-intro">
  77. <a href=""><img src="static/images/22.jpg" alt=""></a>
  78. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  79. </span>
  80. <span><i>&yen;</i>179.00</span>
  81. <span>
  82. <label><input type="number" name="choose" checked></label>
  83. </span>
  84. <span><i>&yen;</i>179.00</span>
  85. <span>
  86. <a href="">删除</a>
  87. <a href="">移到我的关注</a>
  88. </span>
  89. </div>
  90. </main>
  91. <footer>
  92. <span>数量:<i>3</i></span>
  93. <span>金额:<i>927.00</i></span>
  94. <button>去结算</button>
  95. </footer>
  96. </div>
  97. <!--引用public-footer代码-->
  98. <footer class="public-footer">
  99. <div>
  100. <a href="">简介</a>
  101. <a href="">联系我们</a>
  102. <a href="">招聘信息</a>
  103. <a href="">友情链接</a>
  104. <a href="">用户服务协议</a>
  105. <a href="">隐私权声明</a>
  106. <a href="">法律投诉声明</a>
  107. </div>
  108. <div><span>LOGO</span></div>
  109. <div>
  110. <p>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</p>
  111. <p>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</p>
  112. <p>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</p>
  113. </div>
  114. <div>
  115. <p>关注公众号</p>
  116. <img src="static/images/erwei-code.png" alt="">
  117. </div>
  118. </footer>
  119. </body>
  120. </html>

CSS代码

  1. /*初始化样式*/
  2. @import "static/css/reset.css";
  3. /*引入头部css*/
  4. @import "public_header.css";
  5. /*引入尾部css*/
  6. @import "public_footer.css";
  7. /*购物车整体样式*/
  8. .shop-shopping-cart {
  9. width: 1200px;
  10. background-color: #fff;
  11. margin: 30px auto;
  12. padding: 15px 0;
  13. border-radius: 8px;
  14. box-sizing: border-box;
  15. }
  16. /*鼠标*/
  17. .shop-shopping-cart:hover {
  18. box-shadow: 0 0 8px #888888;
  19. }
  20. /*标题*/
  21. .shop-shopping-cart > h3 {
  22. font-size: 20px;
  23. text-align: center;
  24. /*取消加粗*/
  25. font-weight: normal;
  26. margin-bottom: 20px;
  27. }
  28. /*头部*/
  29. .shop-shopping-cart > header {
  30. height: 40px;
  31. border-bottom: 1px solid #cccccc;
  32. display: flex;
  33. justify-content: space-around;
  34. align-items: center;
  35. }
  36. /*主体*/
  37. .shop-shopping-cart > main {
  38. margin: 20px 0;
  39. }
  40. .shop-shopping-cart > main > div {
  41. height: 80px;
  42. display: flex;
  43. justify-content: space-around;
  44. align-items: center;
  45. }
  46. .shop-shopping-cart > main > div:hover {
  47. background-color: lightcyan;
  48. }
  49. .shop-shopping-cart > main > div .pic-intro img {
  50. width: 60px;
  51. height: 45px;
  52. margin-right: 10px;
  53. }
  54. .shop-shopping-cart > main > div .pic-intro {
  55. /*转为flex,默认水平排列*/
  56. display: flex;
  57. }
  58. .shop-shopping-cart > main > div .pic-intro > a:last-of-type {
  59. /*设置宽度,文字描换行*/
  60. width: 155px;
  61. margin-left: 40px;
  62. }
  63. .shop-shopping-cart > main > div a:hover {
  64. background-color: lightcyan;
  65. }
  66. /*调整main之间距离*/
  67. .shop-shopping-cart > main > div > span:first-of-type {
  68. position: relative;
  69. left: 33px;
  70. }
  71. .shop-shopping-cart > main > div > .pic-intro {
  72. position: relative;
  73. left: 25px;
  74. }
  75. .shop-shopping-cart > main > div > span:nth-of-type(3) {
  76. position: relative;
  77. left: -55px;
  78. }
  79. .shop-shopping-cart > main > div > span:nth-of-type(3) i {
  80. margin-right: 10px;
  81. }
  82. .shop-shopping-cart > main > div > span:nth-of-type(4) {
  83. position: relative;
  84. left: -25px;
  85. }
  86. .shop-shopping-cart > main > div > span:nth-of-type(4) input {
  87. width: 60px;
  88. }
  89. .shop-shopping-cart > main > div > span:nth-last-of-type(2) {
  90. position: relative;
  91. left: 0px;
  92. }
  93. .shop-shopping-cart > main > div > span:nth-last-of-type(2) i {
  94. margin-right: 10px;
  95. color: green;
  96. }
  97. .shop-shopping-cart > main > div > span:last-of-type {
  98. position: relative;
  99. left: 30px;
  100. }
  101. .shop-shopping-cart > main > div > span:last-of-type i {
  102. color: green;
  103. font-size: 1.01rem;
  104. margin-right: 10px;
  105. }
  106. /*尾部*/
  107. .shop-shopping-cart > footer {
  108. height: 70px;
  109. padding: 20px;
  110. border-top: 1px solid #cccccc;
  111. box-sizing: border-box;
  112. display: flex;
  113. justify-content: flex-end;
  114. align-items: center;
  115. }
  116. .shop-shopping-cart > footer >*:not(:last-child) {
  117. width: 180px;
  118. }
  119. .shop-shopping-cart > footer > button {
  120. height: 40px;
  121. width: 120px;
  122. background-color: lightcoral;
  123. border: none;
  124. color: white;
  125. font-size: 1.1rem;
  126. }
  127. .shop-shopping-cart > footer > button:hover{
  128. background-color: seagreen;
  129. cursor:pointer;
  130. }
  131. .shop-shopping-cart > footer > span:first-of-type i {
  132. margin-left: 3px;
  133. }

效果图

二、结算页

html代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>商城结算</title>
  6. <link rel="stylesheet" href="shop_shooping_pay.css">
  7. </head>
  8. <body>
  9. <div class="shop-shopping-pay">
  10. <h2>填写并核对定单信息</h2>
  11. <!-- 收货信息-->
  12. <div class="information">
  13. <div>
  14. <h3>收货人信息</h3>
  15. <span>新增收货地址</span>
  16. </div>
  17. <span>赵大叔 云南 昆明 ******** 183*******3</span>
  18. <span>更多地址</span>
  19. </div>
  20. <!-- 支付方式-->
  21. <div class="payment-mothod">
  22. <h3>支付方式</h3>
  23. <div>
  24. <span>货到付款</span>
  25. <span>在线支付</span>
  26. <span>更多</span>
  27. </div>
  28. </div>
  29. <!-- 送货清单-->
  30. <div class="delivery-list">
  31. <h3>送货清单</h3>
  32. <header>
  33. <span>
  34. <input type="checkbox" id="all-selected" checked>
  35. <label for="all-selected">全选</label>
  36. </span>
  37. <span>商品</span>
  38. <span>单价</span>
  39. <span>数量</span>
  40. <span>小计</span>
  41. <span>操作</span>
  42. </header>
  43. <div>
  44. <span>
  45. <label><input type="checkbox" name="count" value="1" min="1"></label>
  46. </span>
  47. <span class="pic-intro">
  48. <a href=""><img src=homework/static/images/1111.jpg" alt=""></a>
  49. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  50. </span>
  51. <span><i>&yen;</i>179.00</span>
  52. <span>
  53. <label><input type="number" name="choose" checked></label>
  54. </span>
  55. <span><i>&yen;</i>179.00</span>
  56. <span>
  57. <a href="">删除</a>
  58. <a href="">移到我的关注</a>
  59. </span>
  60. </div>
  61. <div>
  62. <span>
  63. <label><input type="checkbox" name="count" value="1" min="1"></label>
  64. </span>
  65. <span class="pic-intro">
  66. <a href=""><img src="homework/static/images/1111.jpg" alt=""></a>
  67. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  68. </span>
  69. <span><i>&yen;</i>179.00</span>
  70. <span>
  71. <label><input type="number" name="choose" checked></label>
  72. </span>
  73. <span><i>&yen;</i>179.00</span>
  74. <span>
  75. <a href="">删除</a>
  76. <a href="">移到我的关注</a>
  77. </span>
  78. </div>
  79. <div>
  80. <span>
  81. <label><input type="checkbox" name="count" value="1" min="1"></label>
  82. </span>
  83. <span class="pic-intro">
  84. <a href=""><img src="homework/static/images/22.jpg" alt=""></a>
  85. <a href="">创维盒子T2 电视机顶盒 智能网络盒子4核16G闪存 高清电视无线wifi</a>
  86. </span>
  87. <span><i>&yen;</i>179.00</span>
  88. <span>
  89. <label><input type="number" name="choose" checked></label>
  90. </span>
  91. <span><i>&yen;</i>179.00</span>
  92. <span>
  93. <a href="">删除</a>
  94. <a href="">移到我的关注</a>
  95. </span>
  96. </div>
  97. </div>
  98. <!-- 确认支付-->
  99. <div class="place-order">
  100. <span><i>应付总额</i>&yen;927.00</span>
  101. <div>
  102. <span>寄送至:云南 昆明 ******** </span>
  103. <span>收货人:赵大叔 183*******3</span>
  104. </div>
  105. <button type="button">提交定单</button>
  106. </div>
  107. </div>
  108. </body>
  109. </html>

CSS代码

  1. @import "homework/static/css/reset.css";
  2. .shop-shopping-pay {
  3. width: 1000px;
  4. margin: 10px auto auto;
  5. /*outline: 1px dashed red;*/
  6. }
  7. .shop-shopping-pay > .information {
  8. width: 900px;
  9. margin: 10px auto auto;
  10. display: flex;
  11. flex-direction: column;
  12. border: 1px;
  13. }
  14. .shop-shopping-pay > .information > div {
  15. display: flex;
  16. justify-content: space-between;
  17. margin-top: 10px;
  18. }
  19. .shop-shopping-pay > .information > span {
  20. margin-left: 30px;
  21. }
  22. .shop-shopping-pay > .payment-mothod {
  23. width: 900px;
  24. margin: 10px auto auto;
  25. display: flex;
  26. flex-direction: column;
  27. }
  28. .shop-shopping-pay > .payment-mothod > div {
  29. margin-left: 30px;
  30. display: flex;
  31. }
  32. /*头部*/
  33. .shop-shopping-pay > .delivery-list > h3 {
  34. margin-top: 10px;
  35. }
  36. .shop-shopping-pay > .delivery-list > header {
  37. margin-top: 10px;
  38. }
  39. .shop-shopping-pay > .delivery-list > header {
  40. height: 40px;
  41. border-bottom: 1px solid #cccccc;
  42. display: flex;
  43. justify-content: space-around;
  44. align-items: center;
  45. }
  46. .shop-shopping-pay > .delivery-list {
  47. width: 900px;
  48. margin: auto;
  49. }
  50. .shop-shopping-pay > .delivery-list > div {
  51. margin-left: 30px;
  52. }
  53. .shop-shopping-pay > .delivery-list > div {
  54. height: 80px;
  55. display: flex;
  56. justify-content: space-around;
  57. align-items: center;
  58. }
  59. .shop-shopping-pay > .delivery-list > div:hover {
  60. background-color: lightcyan;
  61. }
  62. .shop-shopping-pay > .delivery-list > div .pic-intro img {
  63. width: 70px;
  64. height: 70px;
  65. }
  66. .shop-shopping-pay > .delivery-list > div .pic-intro {
  67. /*转为flex,默认水平排列*/
  68. display: flex;
  69. }
  70. .shop-shopping-pay > .delivery-list > div .pic-intro > a:last-of-type {
  71. /*设置宽度,文字描换行*/
  72. width: 100px;
  73. margin-left: 5px;
  74. }
  75. .shop-shopping-pay > .delivery-list > div a:hover {
  76. background-color: lightcyan;
  77. }
  78. /*调整main之间距离*/
  79. .shop-shopping-pay > .delivery-list > div > span:first-of-type {
  80. position: relative;
  81. }
  82. .shop-shopping-pay > .delivery-list > div > .pic-intro {
  83. position: relative;
  84. left: 10px;
  85. }
  86. .shop-shopping-pay > .delivery-list > div > span:nth-of-type(3) {
  87. position: relative;
  88. left: -25px;
  89. }
  90. .shop-shopping-pay > .delivery-list > div > span:nth-of-type(3) i {
  91. margin-right: 5px;
  92. }
  93. .shop-shopping-pay > .delivery-list > div > span:nth-of-type(4) {
  94. position: relative;
  95. left: -1px;
  96. }
  97. .shop-shopping-pay > .delivery-list > div > span:nth-of-type(4) input {
  98. width: 60px;
  99. }
  100. .shop-shopping-pay > .delivery-list > div > span:nth-last-of-type(2) {
  101. position: relative;
  102. left: 20px;
  103. }
  104. .shop-shopping-pay > .delivery-list > div > span:nth-last-of-type(2) i {
  105. margin-right: 10px;
  106. color: green;
  107. }
  108. .shop-shopping-pay > .delivery-list > div > span:last-of-type {
  109. position: relative;
  110. left: 30px;
  111. }
  112. .shop-shopping-pay > .delivery-list > div > span:last-of-type i {
  113. color: green;
  114. font-size: 1.01rem;
  115. margin-right: 10px;
  116. }
  117. .shop-shopping-pay > .place-order {
  118. width: 900px;
  119. margin: 10px auto auto;
  120. display: flex;
  121. flex-direction: column;
  122. align-items: flex-end;
  123. }
  124. .shop-shopping-pay > .place-order div {
  125. display: flex;
  126. }
  127. .shop-shopping-pay > .place-order > span:first-of-type i {
  128. margin-right: 30px;
  129. }
  130. .shop-shopping-pay > .place-order > button {
  131. width: 150px;
  132. height: 35px;
  133. background-color: red;
  134. color: white;
  135. font-size: 1.2rem;
  136. }

效果图

个人总结:
堪称最丑结算页面了,页面美化方面十分欠缺。

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