博客列表 >购物车与结算

购物车与结算

安
原创
2020年01月02日 16:40:061317浏览

1、效果图


2、购物车代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="dome1.css">
  6. <title>Title</title>
  7. </head>
  8. <body>
  9. <header>
  10. <div 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. </div>
  21. </header>
  22. <!-- 购物车代码 -->
  23. <!-- 头部 -->
  24. <div class="head">
  25. <img src="static/images/logo.png" alt="">
  26. <span>购物车</span>
  27. </div>
  28. <!-- 1行7列 -->
  29. <div class="headline">
  30. <label><input name="search" type="checkbox" value=""></label>
  31. <span>全选</span>
  32. <span>商品</span>
  33. <span>商品简介</span>
  34. <span>单价</span>
  35. <span>数量</span>
  36. <span>小计</span>
  37. <span>操作</span>
  38. </div>
  39. <!-- 购物车8列 -->
  40. <div class="content">
  41. <div class="nav">
  42. <input name="search" type="checkbox" value=""><label for="search"></label>
  43. <img src="imges/1.jpg.下载" alt="">
  44. <span> 杉城 网红休闲零食大礼包一整箱送女友女生儿童礼盒美食品超市</span>
  45. <span>零食大礼包</span>
  46. <span>¥109.9</span>
  47. <span>
  48. <select>
  49. <option value="1">1</option>
  50. <option value="2">2</option>
  51. <option value="3">3</option>
  52. </select>
  53. </span>
  54. <span>109.9</span>
  55. <span>删除</span>
  56. </div>
  57. <div class="nav">
  58. <input name="search" type="checkbox" value=""><label for="search"></label>
  59. <img src="imges/1.jpg.下载" alt="">
  60. <span> 杉城 网红休闲零食大礼包一整箱送女友女生儿童礼盒美食品超市</span>
  61. <span>零食大礼包</span>
  62. <span>¥109.9</span>
  63. <span>
  64. <select>
  65. <option value="1">1</option>
  66. <option value="2">2</option>
  67. <option value="3">3</option>
  68. </select>
  69. </span>
  70. <span>109.9</span>
  71. <span>删除</span>
  72. </div>
  73. <div class="nav">
  74. <input name="search" type="checkbox" value=""><label for="search"></label>
  75. <img src="imges/1.jpg.下载" alt="">
  76. <span> 杉城 网红休闲零食大礼包一整箱送女友女生儿童礼盒美食品超市</span>
  77. <span>零食大礼包</span>
  78. <span>¥109.9</span>
  79. <span>
  80. <select>
  81. <option value="1">1</option>
  82. <option value="2">2</option>
  83. <option value="3">3</option>
  84. </select>
  85. </span>
  86. <span>109.9</span>
  87. <span>删除</span>
  88. </div>
  89. <div class="nav">
  90. <input name="search" type="checkbox" value=""><label for="search"></label>
  91. <img src="imges/1.jpg.下载" alt="">
  92. <span> 杉城 网红休闲零食大礼包一整箱送女友女生儿童礼盒美食品超市</span>
  93. <span>零食大礼包</span>
  94. <span>¥109.9</span>
  95. <span>
  96. <select>
  97. <option value="1">1</option>
  98. <option value="2">2</option>
  99. <option value="3">3</option>
  100. </select>
  101. </span>
  102. <span>109.9</span>
  103. <span>删除</span>
  104. </div>
  105. </div>
  106. <!-- 底部结算栏,1行6列,grid -->
  107. <div class="foot">
  108. <label><input name="all" type="checkbox" value=""></label>
  109. <span>全选</span>
  110. <div>
  111. <a href="">删除选中商品</a>
  112. <a href="">移到关注</a>
  113. <a href="">清理购物车</a>
  114. </div>
  115. <span>已选择 4 件商品</span>
  116. <div>
  117. <div>总价:¥ 439.60</div>
  118. <div>促销:-¥0.00</div>
  119. </div>
  120. <a href="">去结算</a>
  121. </div>
  122. <!-- 底部html代码 -->
  123. <footer class="public-footer">
  124. <div>
  125. <a href="">简介</a>
  126. <a href="">联系我们</a>
  127. <a href="">招聘信息</a>
  128. <a href="">友情链接</a>
  129. <a href="">用户服务协议</a>
  130. <a href="">隐私权声明</a>
  131. <a href="">法律投诉声明</a>
  132. </div>
  133. <div><span>LOGO</span></div>
  134. <div>
  135. <p>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</p>
  136. <p>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</p>
  137. <p>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</p>
  138. </div>
  139. <div>
  140. <p>关注公众号</p>
  141. <img src="static/images/erwei-code.png" alt="">
  142. </div>
  143. </footer>
  144. </body>
  145. </html>

购物车css代码

  1. /*列表*/
  2. .head {
  3. width: 1020px;
  4. align-self: center;
  5. display: flex;
  6. margin: 20px auto;
  7. }
  8. .head > img {
  9. width: 120px;
  10. height: 42px;
  11. display: block;
  12. margin-left: 20px;
  13. }
  14. .head > span {
  15. height: 42px;
  16. line-height: 42px;
  17. font-size: 20px;
  18. margin-left: 24px;
  19. /* font-weight: bold; */
  20. }
  21. .headline {
  22. width: 1020px;
  23. height: 40px;
  24. background-color: #f3f3f3;
  25. margin: 20px auto;
  26. border: 1px solid #e7e7e7;
  27. position: relative;
  28. }
  29. .headline > label {
  30. width: 30px;
  31. line-height: 40px;
  32. text-align: center;
  33. position: absolute;
  34. left: 1px;
  35. }
  36. .headline > span:nth-of-type(1) {
  37. width: 90px;
  38. line-height: 40px;
  39. padding-left: 10px;
  40. position: absolute;
  41. left: 12px;
  42. }
  43. .headline > span:nth-of-type(2) {
  44. width: 420px;
  45. line-height: 40px;
  46. padding-left: 10px;
  47. position: absolute;
  48. left: 140px;
  49. }
  50. .headline > span:nth-of-type(3) {
  51. width: 110px;
  52. line-height: 40px;
  53. text-align: right;
  54. padding-right: 10px;
  55. position: absolute;
  56. left: 300px;
  57. }
  58. .headline > span:nth-of-type(4) {
  59. width: 110px;
  60. line-height: 40px;
  61. text-align: center;
  62. position: absolute;
  63. right: 260px;
  64. }
  65. .headline > span:nth-of-type(5) {
  66. width: 110px;
  67. line-height: 40px;
  68. text-align: center;
  69. padding-right: 10px;
  70. position: absolute;
  71. right: 140px;
  72. }
  73. .headline > span:nth-of-type(6) {
  74. width: 110px;
  75. line-height: 40px;
  76. padding-left: 10px;
  77. text-align: center;
  78. position: absolute;
  79. right: 44px;
  80. }
  81. .headline > span:nth-of-type(7) {
  82. line-height: 40px;
  83. text-align: center;
  84. position: absolute;
  85. right: 3px;
  86. }
  87. /*购物车*/
  88. .content > .nav {
  89. width: 1020px;
  90. margin: 20px auto;
  91. border: 1px solid #e7e7e7;
  92. background-color: #fff4e8;
  93. display: grid;
  94. grid-template-columns: 30px 90px 210px 210px 110px 110px 110px 110px 40px;
  95. grid-row-gap: 20px;
  96. }
  97. .content > .nav > label {
  98. width: 30px;
  99. text-align: center;
  100. /* padding-top: 10px; */
  101. margin: 10px 0;
  102. }
  103. .content > .nav > img {
  104. width: 70px;
  105. margin: 10px;
  106. border: 1px solid #e7e7e7;
  107. }
  108. .content > .nav > span:nth-of-type(1) {
  109. margin: 10px;
  110. }
  111. .content > .nav > span:nth-of-type(2) {
  112. margin: 10px;
  113. }
  114. .content > .nav > span:nth-of-type(3) {
  115. text-align: center;
  116. margin: 10px;
  117. }
  118. .content > .nav > span:nth-of-type(4) {
  119. text-align: center;
  120. margin: 10px;
  121. }
  122. .content > .nav > span:nth-of-type(5) {
  123. text-align: center;
  124. margin: 10px;
  125. }
  126. .content > .nav > span:nth-of-type(6) {
  127. text-align: center;
  128. margin: 10px;
  129. }
  130. .foot {
  131. width: 1020px;
  132. height: 40px;
  133. margin: 20px auto;
  134. /* border: 1px solid #e7e7e7; */
  135. background-color: #fff4e8;
  136. display: grid;
  137. grid-template-columns: 30px 40px 560px 100px 150px 100px;
  138. /* grid-template-rows: 30px 30px; */
  139. }
  140. .foot > label {
  141. line-height: 40px;
  142. text-align: center;
  143. }
  144. .foot > span:first-of-type {
  145. line-height: 40px;
  146. text-align: center;
  147. }
  148. .foot > div > a {
  149. line-height: 40px;
  150. margin: 0 5px;
  151. color: grey;
  152. }
  153. .foot > span:last-of-type {
  154. line-height: 20px;
  155. }
  156. .foot > div > div {
  157. line-height: 20px;
  158. text-align: right;
  159. margin-right: 10px;
  160. }
  161. .foot > a {
  162. line-height: 40px;
  163. color: white;
  164. background-color: #e64347;
  165. text-align: center;
  166. font-size: 18px;
  167. }

3、结算页代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>结算页</title>
  6. <link rel="stylesheet" href="dome2.css">
  7. </head>
  8. <body>
  9. <header>
  10. <div 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. </div>
  21. </header>
  22. <div class="main">
  23. <div class="head">
  24. <a href=""><img src="static/images/logo.png" alt=""></a>
  25. </div>
  26. <!--收货地址-->
  27. <div class="head-one">
  28. <h1>确认收货地址</h1>
  29. <a href="">管理收货地址</a>
  30. </div>
  31. <div class="head-two">
  32. <div class="head-tad">
  33. <span class="head-nex">
  34. <b>山东省山东市神州区百威镇周先生183*****65</b>
  35. </span>
  36. </div>
  37. <div>
  38. <a href="">修改本地地址</a>
  39. </div>
  40. </div>
  41. <!--订单信息-->
  42. <div class="headline">
  43. <div class="headline-one">
  44. <h2><b>确认订单信息</b></h2>
  45. </div>
  46. </div>
  47. <div class="nav">
  48. <input name="search" type="checkbox" value=""><label for="search"></label>
  49. <img src="imges/1.jpg.下载" alt="">
  50. <span> 杉城 网红休闲零食大礼包一整箱送女友女生儿童礼盒美食品超市</span>
  51. <span>零食大礼包</span>
  52. <span>¥109.9</span>
  53. <span>
  54. <select>
  55. <option value="1">1</option>
  56. <option value="2">2</option>
  57. <option value="3">3</option>
  58. </select>
  59. </span>
  60. <span>109.9</span>
  61. </div>
  62. <div class="nav-1">
  63. <div class="nav-2">
  64. <span>
  65. <input type="checkbox">
  66. </span>
  67. <span>朋友代付</span>
  68. </div>
  69. <div class="nav-3">
  70. <span>
  71. <input type="checkbox">
  72. </span>
  73. <span>匿名购买</span>
  74. </div>
  75. </div>
  76. <div class="box">
  77. <div class="box-war">
  78. <div class="box-she">
  79. <span>实付款:</span>
  80. <span>¥</span>
  81. <span>109.9</span>
  82. </div>
  83. <div class="box-ord">
  84. <span>寄送至:</span>
  85. <span>山东省 山东市 神州区 百威镇</span>
  86. </div>
  87. <div class="box-conf">
  88. <span>收货人</span>
  89. <span>183*****65</span>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="foot">
  94. <div class="foot-wrap">
  95. <button>提交订单</button>
  96. </div>
  97. </div>
  98. </div>
  99. <footer class="public-footer">
  100. <div>
  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. <a href="">法律投诉声明</a>
  108. </div>
  109. <div><span>LOGO</span></div>
  110. <div>
  111. <p>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</p>
  112. <p>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</p>
  113. <p>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</p>
  114. </div>
  115. <div>
  116. <p>关注公众号</p>
  117. <img src="static/images/erwei-code.png" alt="">
  118. </div>
  119. </body>
  120. </html>

结算页css代码

  1. .main{
  2. width: 1000px;
  3. margin: auto;
  4. }
  5. .main > .head {
  6. width: 1000px;
  7. height: 70px;
  8. position: relative;
  9. }
  10. .main > .head > a > img {
  11. width: 170px;
  12. height: 70px;
  13. position: absolute;
  14. }
  15. /*收货地址*/
  16. .main > .head-one {
  17. width: 1000px;
  18. height: 60px;
  19. display: flex;
  20. justify-content: space-between;
  21. border-bottom:1px solid #cccccc;
  22. line-height: 60px;
  23. }
  24. .main > .head-one > h1 {
  25. font-size: 16px;
  26. }
  27. .head-two {
  28. width: 1000px;
  29. height: 60px;
  30. display: flex;
  31. justify-content: space-between;
  32. line-height: 60px;
  33. }
  34. .head-two > .head-tad {
  35. margin: 10px;
  36. font-size: 16px;
  37. }
  38. .head-two > div {
  39. margin-right: 10px;
  40. font-size: 16px;
  41. }
  42. /*订单信息*/
  43. .main > .headline {
  44. width: 1000px;
  45. }
  46. .main > .headline > .headline-one > h2{
  47. font-size: 16px;
  48. color: black;
  49. margin-left: 10px;
  50. border-bottom: 1px solid #178cee;
  51. }
  52. /*产品*/
  53. .main > .nav {
  54. width: 1000px;
  55. margin: 20px auto;
  56. border: 1px solid #e7e7e7;
  57. background-color: #fff4e8;
  58. display: grid;
  59. grid-template-columns: 30px 90px 210px 210px 110px 110px 110px 110px 40px;
  60. grid-row-gap: 20px;
  61. }
  62. .main > .nav > label {
  63. width: 30px;
  64. text-align: center;
  65. /* padding-top: 10px; */
  66. margin: 10px 0;
  67. }
  68. .main > .nav > img {
  69. width: 70px;
  70. margin: 10px;
  71. border: 1px solid #e7e7e7;
  72. }
  73. .main > .nav > span:nth-of-type(1) {
  74. margin: 10px;
  75. }
  76. .main > .nav > span:nth-of-type(2) {
  77. margin: 10px;
  78. }
  79. .main > .nav > span:nth-of-type(3) {
  80. text-align: center;
  81. margin: 10px;
  82. }
  83. .main > .nav > span:nth-of-type(4) {
  84. text-align: center;
  85. margin: 10px;
  86. }
  87. .main > .nav > span:nth-of-type(5) {
  88. text-align: center;
  89. margin: 10px;
  90. }
  91. .main > .nav > span:nth-of-type(6) {
  92. text-align: center;
  93. margin: 10px;
  94. }
  95. /*结算方式*/
  96. .main > .nav-1 {
  97. width: 1000px;
  98. display: flex;
  99. justify-content: flex-end;
  100. }
  101. .main > .nav-1 > .nav-2 > span {
  102. font-size: 14px;
  103. }
  104. .main > .nav-1 > .nav-2 > span:last-of-type{
  105. margin-right: 20px;
  106. }
  107. .main > .nav-1 > .nav-3 > span {
  108. font-size: 14px;
  109. }
  110. .main > .nav-1 > .nav-3 > span:last-of-type{
  111. margin-right: 3px;
  112. }
  113. /*结算金额方式*/
  114. .box{
  115. width: 1000px;
  116. display: flex;
  117. justify-content: flex-end;
  118. }
  119. .box > .box-war {
  120. width: 385px;
  121. height: 125px;
  122. border: 1px solid red;
  123. text-align: right;
  124. }
  125. .box > .box-war > .box-she {
  126. height: 50px;
  127. line-height: 50px;
  128. margin-right: 10px;
  129. }
  130. .box > .box-war > .box-she > span:first-of-type{
  131. font-size: 15px;
  132. color: #2b2b2b;
  133. }
  134. .box > .box-war > .box-she > span:nth-of-type(2){
  135. font-size: 25px;
  136. color: #555555;
  137. }
  138. .box > .box-war > .box-she > span:nth-of-type(3){
  139. font-size: 25px;
  140. color: red;
  141. }
  142. .box > .box-war > .box-ord {
  143. height: 25px;
  144. line-height: 25px;
  145. margin-right: 10px;
  146. }
  147. .box > .box-war > .box-ord > span:first-of-type{
  148. font-size: 13px;
  149. color: black;
  150. }
  151. .box > .box-war > .box-ord > span:last-of-type {
  152. font-size: 13px;
  153. color: black;
  154. margin-bottom: 5px;
  155. }
  156. .box > .box-war > .box-conf {
  157. height: 25px;
  158. line-height: 25px;
  159. margin-right: 10px;
  160. }
  161. .box > .box-war > .box-conf > span:first-of-type {
  162. font-size: 13px;
  163. color: #2b2b2b;
  164. margin-top: 5px;
  165. }
  166. .box > .box-war > .box-conf > span:last-of-type {
  167. font-size: 13px;
  168. color: #2b2b2b;
  169. margin-top: 5px;
  170. }
  171. /*提交按钮*/
  172. .foot {
  173. width: 1000px;
  174. display: flex;
  175. justify-content: flex-end;
  176. }
  177. .foot > .foot-wrap > button {
  178. width: 180px;
  179. height: 40px;
  180. background-color: #df5000;
  181. outline: none;
  182. }
  183. .foot > .foot-wrap > button:hover{
  184. cursor: pointer;
  185. }

4、总结
标签运用不熟练,什么地方该用什么标签概念比较迷糊。以前学的定位有点遗忘,知识掌握不扎实,grid命名之后不太会套用,网格布局还需要加强。

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