博客列表 >12月31日作业:仿京东购物车和结算页

12月31日作业:仿京东购物车和结算页

李东亚¹⁸⁰³⁹⁵⁴⁰¹²⁰
李东亚¹⁸⁰³⁹⁵⁴⁰¹²⁰原创
2020年01月02日 15:07:031678浏览

作业一:
1、京东购物车:

分析:原计划grid布局但考虑到grid布局只能控制子代元素,而每个商品又属于1条(模板)信息,直接通过grid布局,一条商品信息不方便后期统一调整,整体通过flex布局,然后每条产品信息grid布局(单行)可以通过画竖线很好的控制宽度。
2、html代码:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="shopping_trolley.css">
  6. <title>购物车案例</title>
  7. </head>
  8. <body>
  9. <div class="public-header">
  10. <a href="">网站首页</a>
  11. <a href="">专题</a>
  12. <a href="">网站导航</a>
  13. <a href="">二手商品</a>
  14. <a href="">讨论</a>
  15. <span>
  16. <a href=""><<i calss="iconfont icon-huiyuan2"></i>登陆</a>
  17. <a href=""><i>免费注册</i></a>
  18. </span>
  19. </div>
  20. <div class="shopping-trolley">
  21. <div class="logo-search">
  22. <div class="jd-logo">
  23. <a href=""><img src="../../static/images/logo.png" alt=""></a>
  24. <span>购物车</span>
  25. </div>
  26. <div class="search">
  27. <input type="search" name="" id="search">
  28. <button><label for="search">搜索</label></button>
  29. </div>
  30. </div>
  31. <div class="trolley">
  32. <div class="head">
  33. <span>全部商品 3</span>
  34. <div class="address">
  35. <span>配送至:</span>
  36. <select name="" id="">
  37. <option value="">北京市长安路1号</option>
  38. <option value="">郑州市金水区长安路1号</option>
  39. <option value="">洛阳市新安县金斗路1号</option>
  40. </select>
  41. </div>
  42. </div>
  43. <div class="body">
  44. <div class="top">
  45. <input type="checkbox" id="checked">
  46. <label for="checked">全选</label>
  47. <span>商品</span>
  48. <span>单价</span>
  49. <span>数量</span>
  50. <span>小计</span>
  51. <span>操作</span>
  52. </div>
  53. <div class="shop-list">
  54. <div class="shop">
  55. <div class="up">
  56. <input type="checkbox">
  57. <label for="">小米智联万物专卖店</label>
  58. </div>
  59. <div class="down" .>
  60. <input type="checkbox" >
  61. <a href=""><img src="../../static/images/shop1.jpg" alt=""></a>
  62. <div class="shop-describe">
  63. <sapn>产品描述</sapn>
  64. <br>
  65. <span>选服务</span>
  66. </div>
  67. <span>石头扫地机器人</span>
  68. <span>¥2499.00</span>
  69. <div>
  70. <input list="n" value="1"/>
  71. <datalist id="n">
  72. <option value="1">1</option>
  73. <option value="2">3</option>
  74. <option value="3">4</option>
  75. <option value="4">5</option>
  76. </datalist>
  77. <div>
  78. <button></button>
  79. <button></button>
  80. </div>
  81. </div>
  82. <span>¥2499.00</span>
  83. <span><a href="">删除</a></span>
  84. </div>
  85. </div>
  86. <div class="shop">
  87. <div class="up">
  88. <input type="checkbox">
  89. <label for="">小米智联万物专卖店</label>
  90. </div>
  91. <div class="down">
  92. <input type="checkbox" >
  93. <a href=""><img src="../../static/images/shop1.jpg" alt=""></a>
  94. <div class="div" >
  95. <sapn>产品描述</sapn>
  96. <br>
  97. <span>选服务</span>
  98. </div>
  99. <span>石头扫地机器人</span>
  100. <span>¥2499.00</span>
  101. <div>
  102. <input list="n" />
  103. <datalist id="n2-2">
  104. <option value="">1</option>
  105. <option value="">3</option>
  106. <option value="">4</option>
  107. <option value="">5</option>
  108. </datalist>
  109. <div>
  110. <button></button>
  111. <button></button>
  112. </div>
  113. </div>
  114. <span>¥2499.00</span>
  115. <span><a href="">删除</a></span>
  116. </div>
  117. <div class="down">
  118. <input type="checkbox" >
  119. <a href=""><img src="../../static/images/shop1.jpg" alt=""></a>
  120. <div class="div" >
  121. <sapn>产品描述</sapn>
  122. <br>
  123. <span>选服务</span>
  124. </div>
  125. <span>石头扫地机器人</span>
  126. <span>¥2499.00</span>
  127. <div>
  128. <input list="n" />
  129. <datalist id="n2">
  130. <option value="">1</option>
  131. <option value="">3</option>
  132. <option value="">4</option>
  133. <option value="">5</option>
  134. </datalist>
  135. <div>
  136. <button></button>
  137. <button></button>
  138. </div>
  139. </div>
  140. <span>¥2499.00</span>
  141. <span><a href="">删除</a></span>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="bottom">
  147. <div class="left">
  148. <input type="checkbox" id="ck">
  149. <label for="ck">全选</label>
  150. <a href="">删除选中商品</a>
  151. <a href="">移到关注</a>
  152. <a href="">清理购物车</a>
  153. </div>
  154. <div class="right">
  155. <span>已经选择3件商品</span>
  156. <div>
  157. <p>
  158. <span>总价</span>
  159. <span>¥2798.90</span>
  160. </p>
  161. <span>
  162. 促销:-¥0.00
  163. </span>
  164. </div>
  165. <button>
  166. 去结算
  167. </button>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <div class="public-footer">
  173. <div class="nav">
  174. <a href=""><span>链接1</span></a>
  175. <a href=""><span>链接2</span></a>
  176. <a href=""><span>链接3</span></a>
  177. <a href=""><span>链接4</span></a>
  178. <a href=""><span>链接5</span></a>
  179. <a href=""><span>链接6</span></a>
  180. <a href=""><span>链接7</span></a>
  181. </div>
  182. <div class="logo">
  183. <a href=""><img src="../../static/images/logo.png" alt=""></a>
  184. </div>
  185. <div class="info">
  186. <p>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</p>
  187. <p>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</p>
  188. <p>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</p>
  189. </div>
  190. <div>
  191. <p>关注公众号</p>
  192. <img src="../../static/images/erwei-code.png" alt="">
  193. </div>
  194. </div>
  195. </body>
  196. </html>

3、css代码:

  1. @import "../../components/public_reset.css";
  2. @import "../../components/public/public_header/public_header.css";
  3. @import url(../../components/public/public_footer/public_footer.css);
  4. .shopping-trolley {
  5. width: 1200px;
  6. margin: 10px auto;
  7. background-color: #fff;
  8. padding: 10px;
  9. box-sizing: border-box;
  10. }
  11. /*JD-logo/搜索框*/
  12. .shopping-trolley > .logo-search {
  13. height: 100px;
  14. display: flex;
  15. flex-direction: row;
  16. justify-content: space-between;
  17. }
  18. .shopping-trolley > .logo-search > * {
  19. align-self: center;
  20. }
  21. .shopping-trolley > .logo-search > .jd-logo {
  22. display: flex;
  23. justify-content: space-between;
  24. }
  25. .shopping-trolley > .logo-search > .jd-logo span {
  26. font-size:25px;
  27. font-weight: bold;
  28. margin-bottom: 10px;
  29. align-self: flex-end;
  30. }
  31. .shopping-trolley > .logo-search > .search {
  32. display: flex;
  33. }
  34. .shopping-trolley > .logo-search > .search > input {
  35. width: 200px;
  36. height: 30px;
  37. border:2px solid red;
  38. }
  39. .shopping-trolley > .logo-search > .search > button {
  40. width: 40px;
  41. height: 30px;
  42. font-size: 16px;
  43. background-color: #ff0000;
  44. color:white;
  45. text-align: center;
  46. line-height:30px ;
  47. cursor: pointer;
  48. border:none;
  49. }
  50. .shopping-trolley > .logo-search > .search > button > label {
  51. cursor: pointer;
  52. }
  53. .shopping-trolley > .trolley > .head {
  54. display: flex;
  55. justify-content: space-between;
  56. align-items: center;
  57. }
  58. .shopping-trolley > .trolley > .head > span {
  59. font-size: 20px;
  60. font-weight: bold;
  61. color:#ff0000;
  62. border-bottom: 2px solid #ff0000;
  63. padding-bottom: 8px;
  64. }
  65. .shopping-trolley > .trolley > .head > .address > select{
  66. width: 200px;
  67. }
  68. .shopping-trolley > .trolley > .body {
  69. display:flex ;
  70. flex-direction: column;
  71. }
  72. .shopping-trolley > .trolley > .body > .top {
  73. height: 40px;
  74. background-color: #F3F3F3;
  75. padding-left: 10px;
  76. display: grid;
  77. grid-template-columns:
  78. 0.3fr 1.4fr 6fr 1fr 1.5fr 1.5fr 1.5fr;
  79. align-content:center;
  80. align-items: end;
  81. }
  82. .shopping-trolley > .trolley > .body > .shop-list {
  83. display: flex;
  84. flex-direction: column;
  85. }
  86. .shopping-trolley > .trolley > .body > .shop-list > .shop > .up {
  87. border-bottom: 2px solid #969896;
  88. height: 40px;
  89. display: flex;
  90. padding-left: 10px;
  91. align-items: center;
  92. box-sizing: border-box;
  93. }
  94. .shopping-trolley > .trolley > .body > .shop-list > .shop > .up > label {
  95. margin-left: 12px;
  96. }
  97. /*.shopping-trolley > .trolley > .body > .shop-list > .shop{*/
  98. /* border:1px solid #b0b0b0 ;*/
  99. /* border-top:none;*/
  100. /*}*/
  101. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down {
  102. display: grid;
  103. padding-left: 10px;
  104. padding-bottom: 10px;
  105. padding-top: 8px;
  106. grid-template-columns:
  107. 0.3fr 1.4fr 3fr 3fr 1fr 1.5fr 1.5fr 1.5fr;
  108. border:1px solid #F1F1F1 ;
  109. border-top:none;
  110. }
  111. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down > :nth-child(3) > :last-child{
  112. color: red;
  113. }
  114. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down > :nth-child(6) {
  115. display: flex;
  116. }
  117. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down > :nth-child(6) > input {
  118. width: 30px;
  119. height: 18px;
  120. }
  121. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down > :nth-child(6) > div {
  122. display: flex;
  123. flex-direction: column;
  124. }
  125. .shopping-trolley > .trolley > .body > .shop-list > .shop > .down > :nth-child(6) > div > button{
  126. height: 11px;
  127. font-size: 6px;
  128. line-height: 9px;
  129. /*border-style: none;*/
  130. }
  131. .shopping-trolley > .trolley > .bottom {
  132. height: 50px;
  133. border-top:1px solid #969896;
  134. border-bottom:1px solid #969896;
  135. padding-left: 10px;
  136. display: flex;
  137. justify-content: space-between;
  138. align-items: center;
  139. }
  140. .shopping-trolley > .trolley > .bottom > .left > label {
  141. margin-left: 12px;
  142. }
  143. .shopping-trolley > .trolley > .bottom > .left > * {
  144. margin-left: 5px;
  145. }
  146. .shopping-trolley > .trolley > .bottom > .left > :last-child {
  147. font-weight: bold;
  148. }
  149. .shopping-trolley > .trolley > .bottom > .left > a:hover {
  150. color:#ff0000;
  151. }
  152. .shopping-trolley > .trolley > .bottom > .right {
  153. display: flex;
  154. color:#b0b0b0;
  155. }
  156. .shopping-trolley > .trolley > .bottom > .right > * {
  157. margin-left: 20px;
  158. }
  159. .shopping-trolley > .trolley > .bottom > .right > :nth-child(2) > span {
  160. color:#222222;
  161. }
  162. .shopping-trolley > .trolley > .bottom > .right > button {
  163. width: 70px;
  164. height: 50px;
  165. border-style: none;
  166. background-color: #ff0000;
  167. color:white;
  168. }
  169. .shopping-trolley > .trolley > .bottom > .right > button:hover {
  170. cursor: pointer;
  171. }

4、效果图:

作业二:

1、结算页分析
结算页通过分析上下通过flex布局快速实现,中部产品信息和配送方式利用grid布局实现
2、html代码:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="payment.css">
  6. <title>结算页案例</title>
  7. </head>
  8. <body>
  9. <div class="public-header">
  10. <a href="">网站首页</a>
  11. <a href="">专题</a>
  12. <a href="">网站导航</a>
  13. <a href="">二手商品</a>
  14. <a href="">讨论</a>
  15. <span>
  16. <a href=""><<i calss="iconfont icon-huiyuan2"></i>登陆</a>
  17. <a href=""><i>免费注册</i></a>
  18. </span>
  19. </div>
  20. <div class="payment">
  21. <div class="head">
  22. <div class="paying-logo">
  23. <a href=""><img src="../../static/images/logo.png" alt=""></a>
  24. <span>结算页</span>
  25. </div>
  26. <img src="../../static/images/paying-right.png" alt="">
  27. </div>
  28. <h3>填写并核对订单信息</h3>
  29. <div class="pay">
  30. <div class="address">
  31. <div class="top">
  32. <span>收货人信息</span>
  33. <a href="">新增收货地址</a>
  34. </div>
  35. <div class="ads">
  36. <span>郑州居住地</span>
  37. <span>李*** 河南 郑州市 金水区 大石桥街道 文化路****东户 180****0120 <i>默认地址</i></span>
  38. </div>
  39. </div>
  40. <div class="paying">
  41. <span>支付方式</span>
  42. <div>
  43. <span>货到付款</span>
  44. <span><i></i>在线支付</span>
  45. </div>
  46. </div>
  47. <div class="shop-list">
  48. <!--<img src="../../static/images/shop-list.png" alt="">-->
  49. <span>送货清单</span>
  50. <div class="shop-list-top-right">
  51. <a href="">价格说明</a>
  52. <a href="">返回修改购物车</a>
  53. </div>
  54. <div class="shop-send1 bgc1">
  55. <div>
  56. <span>配送方式</span>
  57. <a href="">对应商品</a>
  58. </div>
  59. <span>京东快递</span>
  60. <span><i>配送时间:</i>工作日、双休日、节假日均可送货</span>
  61. </div>
  62. <div class="shop-list-detail bgc2">
  63. <p>商家:京东自营</p>
  64. <div class="detail">
  65. <img src="../../static/images/shop1.jpg" alt="">
  66. <div>
  67. <span> <i>京东超市</i>贵州茅台镇举酌酱香型白酒整箱53度500ml*6瓶私人收藏坤沙纯粮食高粱原浆</span>
  68. <span><i>颜色</i>茅台镇藏酒</span>
  69. <span>不支持7天无理由退货</span>
  70. </div>
  71. <span>¥268.00</span>
  72. <span>×1</span>
  73. <span>无货</span>
  74. </div>
  75. </div>
  76. <div class="shop-sends bgc1">
  77. <span><i>总重量:</i>0.140kg</span>
  78. </div>
  79. <div class="shop-list-detail bgc2">
  80. <p>商家:京东自营</p>
  81. <div class="detail">
  82. <img src="../../static/images/shop1.jpg" alt="">
  83. <div>
  84. <span> <i>京东超市</i>贵州茅台镇举酌酱香型白酒整箱53度500ml*6瓶私人收藏坤沙纯粮食高粱原浆</span>
  85. <span><i>颜色</i>茅台镇藏酒</span>
  86. <span>不支持7天无理由退货</span>
  87. </div>
  88. <span>¥268.00</span>
  89. <span>×1</span>
  90. <span>无货</span>
  91. </div>
  92. </div>
  93. <div class="shop-send1 bgc1">
  94. <div>
  95. <span>配送方式</span>
  96. <a href="">对应商品</a>
  97. </div>
  98. <span>京东快递</span>
  99. <span><i>配送时间:</i>工作日、双休日、节假日均可送货</span>
  100. </div>
  101. <div class="shop-list-detail bgc2">
  102. <p>商家:京东自营</p>
  103. <div class="detail">
  104. <img src="../../static/images/shop1.jpg" alt="">
  105. <div>
  106. <span> <i>京东超市</i>贵州茅台镇举酌酱香型白酒整箱53度500ml*6瓶私人收藏坤沙纯粮食高粱原浆</span>
  107. <span><i>颜色</i>茅台镇藏酒</span>
  108. <span>不支持7天无理由退货</span>
  109. </div>
  110. <span>¥268.00</span>
  111. <span>×1</span>
  112. <span>无货</span>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="pay-foot">
  118. <div class="pay-info">
  119. <div>
  120. <span>3 件商品,总商品金额:</span>
  121. <span>¥2780.90</span>
  122. </div>
  123. <div>
  124. <span>运费:</span>
  125. <span>¥0.00</span>
  126. </div>
  127. </div>
  128. <div class="address-info">
  129. <div>
  130. <span>应付总额:</span>
  131. <span>¥2780.90</span>
  132. </div>
  133. <div>
  134. <span>寄送至: 河南 郑州市 金水区 大石桥街道 文化路1**号院*号楼*单元*层东户</span>
  135. <span>收货人:李** 180****0120</span>
  136. </div>
  137. </div>
  138. <button>提交订单</button>
  139. </div>
  140. </div>
  141. <div class="public-footer">
  142. <div class="nav">
  143. <a href=""><span>链接1</span></a>
  144. <a href=""><span>链接2</span></a>
  145. <a href=""><span>链接3</span></a>
  146. <a href=""><span>链接4</span></a>
  147. <a href=""><span>链接5</span></a>
  148. <a href=""><span>链接6</span></a>
  149. <a href=""><span>链接7</span></a>
  150. </div>
  151. <div class="logo">
  152. <a href=""><img src="../../static/images/logo.png" alt=""></a>
  153. </div>
  154. <div class="info">
  155. <p>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</p>
  156. <p>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</p>
  157. <p>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</p>
  158. </div>
  159. <div>
  160. <p>关注公众号</p>
  161. <img src="../../static/images/erwei-code.png" alt="">
  162. </div>
  163. </div>
  164. </body>
  165. </html>

3、css代码:

  1. @import "../../components/public_reset.css";
  2. @import "../../components/public/public_header/public_header.css";
  3. @import url(../../components/public/public_footer/public_footer.css);
  4. /*结算页头*/
  5. .payment {
  6. width: 1200px;
  7. margin: 10px auto;
  8. background-color: #fff;
  9. }
  10. .payment > .head {
  11. height: 120px;
  12. display: flex;
  13. justify-content: space-between;
  14. padding:0 10px;
  15. box-sizing: border-box;
  16. align-items: center;
  17. }
  18. .payment > .head > div {
  19. display: flex;
  20. }
  21. .payment > .head > div > span {
  22. margin-left: 10px;
  23. font-size: 20px;
  24. align-self: center;
  25. }
  26. .payment > .head > div img {
  27. height: 85px;
  28. }
  29. .payment > .head > :last-child {
  30. width: 500px;
  31. height: 120px;
  32. align-self: self-start;
  33. }
  34. .payment > h3 {
  35. margin-left: 10px;
  36. padding-left: 10px;
  37. color:#969896;
  38. }
  39. /*收获地址*/
  40. .payment > .pay > .address {
  41. border-bottom: 1px solid #b0b0b0;
  42. margin:5px 20px ;
  43. }
  44. .payment > .pay > .address > .top {
  45. font-size: 14px;
  46. color:#222222;
  47. margin: 10px 0;
  48. display: flex;
  49. }
  50. .payment > .pay > .address > .top > :first-child {
  51. font-weight: bold;
  52. margin-left: 15px;
  53. }
  54. .payment > .pay > .address > .top > :last-child {
  55. font-size: 12px;
  56. margin-left: auto;
  57. color: #178CEE;
  58. }
  59. .payment > .pay > .address > .top > :last-child:hover {
  60. color:#ff0000;
  61. }
  62. .payment > .pay > .address > .ads {
  63. height: 50px;
  64. margin-left: 30px;
  65. display: flex;
  66. align-items: center;
  67. box-sizing: border-box;
  68. padding-bottom: 10px;
  69. }
  70. .payment > .pay > .address > .ads > :first-child {
  71. width: 100px;
  72. height: 25px;
  73. border: 2px solid #ff0000;
  74. text-align: center;
  75. line-height: 25px;
  76. }
  77. .payment > .pay > .address > .ads > :last-child {
  78. margin-left: 15px;
  79. display: flex;
  80. }
  81. .payment > .pay > .address > .ads > :last-child > i {
  82. margin-left: 10px;
  83. font-style: normal;
  84. background-color: #666666;
  85. color:#ffffff;
  86. height: 20px;
  87. width: 60px;
  88. text-align: center;
  89. line-height: 20px;
  90. }
  91. /*支付方式*/
  92. .payment > .pay > .paying {
  93. margin:5px 20px;
  94. display: flex;
  95. flex-direction: column;
  96. }
  97. .payment > .pay > .paying > span {
  98. font-size: 14px;
  99. color:#222222;
  100. font-weight: bold;
  101. margin-left: 15px;
  102. }
  103. .payment > .pay > .paying > div {
  104. display: flex;
  105. margin-left: 10px;
  106. margin-bottom: 10px;
  107. }
  108. .payment > .pay > .paying > div > *{
  109. height: 30px;
  110. width: 100px;
  111. background-color:#F3F3F3;
  112. margin-top:15px;
  113. margin-left: 20px;
  114. text-align: center;
  115. line-height: 30px;
  116. border: 1px solid #969896;
  117. cursor: pointer;
  118. }
  119. .payment > .pay > .paying > div > :first-of-type:hover {
  120. box-shadow: 0 0 3px #b0b0b0 inset;
  121. }
  122. .payment > .pay > .paying > div > :last-child {
  123. border: 2px solid #ff0000 ;
  124. box-sizing: border-box;
  125. line-height: 28px;
  126. display: flex;
  127. align-items: center;
  128. }
  129. .payment > .pay > .paying > div > :last-child > i {
  130. background-color: #ff0000;
  131. height: 20px;
  132. width: 20px;
  133. font-style: normal;
  134. color:#ffffff;
  135. margin:0 5px;
  136. line-height: 20px;
  137. text-align: center;
  138. }
  139. /*结算商品内容*/
  140. .payment > .pay > .shop-list {
  141. display: grid;
  142. grid-template-columns: 4fr 8fr;
  143. grid-template-rows:40px 1fr 1fr 1fr;
  144. justify-items:center;
  145. align-items: center;
  146. margin: 5px 20px;
  147. }
  148. .payment > .pay > .shop-list > span {
  149. justify-self: start;
  150. margin-left: 15px;
  151. font-size: 14px;
  152. color:#222222;
  153. font-weight: bold;
  154. }
  155. .payment > .pay > .shop-list > .shop-list-top-right {
  156. justify-self: end;
  157. }
  158. .payment > .pay > .shop-list > .shop-list-top-right > a {
  159. color: #178CEE;
  160. font-size: 12px;
  161. }
  162. .payment > .pay > .shop-list > .shop-list-top-right > a:hover {
  163. color:#ff0000;
  164. }
  165. .payment > .pay > .shop-list > .shop-list-top-right > :last-child {
  166. margin-left: 20px;
  167. }
  168. .payment > .pay > .shop-list >.bgc1 {
  169. background-color: #F7F7F7;
  170. width: 380px;
  171. padding: 15px;
  172. box-sizing: border-box;
  173. }
  174. .payment > .pay > .shop-list >.bgc2 {
  175. background-color: #F3FBFE;
  176. width: 780px;
  177. padding: 15px;
  178. box-sizing: border-box;
  179. }
  180. .payment > .pay > .shop-list > .shop-send1 {
  181. display: flex;
  182. flex-direction: column;
  183. justify-content: space-evenly;
  184. }
  185. .payment > .pay > .shop-list > .shop-send1 > * {
  186. margin: 10px 0;
  187. }
  188. .payment > .pay > .shop-list > .shop-send1 > :first-child {
  189. display: flex;
  190. justify-content: space-between;
  191. }
  192. .payment > .pay > .shop-list > .shop-send1 > :first-child > span {
  193. font-size: 12px;
  194. color:#666666;
  195. font-weight: bold;
  196. }
  197. .payment > .pay > .shop-list > .shop-send1 > :first-child > a {
  198. color:#178CEE;
  199. }
  200. .payment > .pay > .shop-list > .shop-send1 > span:nth-child(2) {
  201. border: 2px solid #ff0000;
  202. width: 100px;
  203. height: 22px;
  204. text-align: center;
  205. line-height: 20px;
  206. margin-left: 20px;
  207. }
  208. .payment > .pay > .shop-list > .shop-send1 > :last-child > i {
  209. font-style: normal;
  210. font-size: 12px;
  211. color: #b0b0b0;
  212. }
  213. .payment > .pay > .shop-list > .shop-list-detail > .detail {
  214. display: grid;
  215. grid-template-columns: 1fr 3.6fr 1.5fr 0.7fr 0.5fr;
  216. }
  217. .payment > .pay > .shop-list > .shop-list-detail > .detail > * {
  218. margin:12px 0;
  219. }
  220. .payment > .pay > .shop-list > .shop-list-detail > .detail > div:first-of-type {
  221. width: 300px;
  222. height: 80px;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. }
  227. .payment > .pay > .shop-list > .shop-sends {
  228. display: flex;
  229. height: 160px;
  230. align-items:flex-end;
  231. }
  232. /*提交订单*/
  233. .payment > .pay-foot {
  234. display: flex;
  235. flex-direction: column;
  236. align-items: flex-end;
  237. padding: 10px 0;
  238. }
  239. .payment > .pay-foot > .pay-info {
  240. display: flex;
  241. flex-direction: column;
  242. justify-content: center;
  243. align-items: flex-end;
  244. margin-right: 15px;
  245. padding: 10px 0;
  246. }
  247. .payment > .pay-foot > .address-info {
  248. width: 1200px;
  249. height: 60px;
  250. background-color: #F4F4F4;
  251. display: flex;
  252. flex-flow: column nowrap;
  253. justify-content: center;
  254. align-items: flex-end;
  255. padding: 10px 0;
  256. }
  257. .payment > .pay-foot > .pay-info > div {
  258. display: flex;
  259. flex-direction: row;
  260. justify-content: flex-end;
  261. margin: 4px 0;
  262. }
  263. .payment > .pay-foot > .pay-info > div > :last-child {
  264. width: 100px;
  265. text-align: end;
  266. }
  267. .payment > .pay-foot > .address-info > *{
  268. margin-right: 15px;
  269. }
  270. .payment > .pay-foot > .address-info > div {
  271. display: flex;
  272. flex-direction: row;
  273. justify-content: flex-end;
  274. margin-top: 4px;
  275. margin-bottom: 4px;
  276. }
  277. .payment > .pay-foot > .address-info > div:first-of-type > :last-child {
  278. width: 100px;
  279. text-align: end;
  280. color:#ff0000;
  281. font-weight: bold;
  282. font-size: 18px;
  283. }
  284. .payment > .pay-foot > .address-info > div:last-of-type > :last-child{
  285. margin-left: 25px;
  286. }
  287. .payment > .pay-foot > button {
  288. border: none;
  289. background-color: #ff0000;
  290. width: 120px;
  291. height: 40px;
  292. font-size: 18px;
  293. font-weight: bold;
  294. color:#ffffff;
  295. border-radius: 3px;
  296. margin-right: 15px;
  297. margin-top:10px;
  298. cursor: pointer;
  299. }
  300. .payment > .pay-foot > button:hover{
  301. background-color: #ED4548;
  302. }

4、效果图:


作业总结:
1、css代码利用率低,写道那一块,写那块的css代码,一些通用的css属性没有很好的规划。
2、grid不熟练,html大部页面通过块可以直接拼接,而用grid布局来调节细节有点大材小用,主要没有大局观,总是从细节写起,所以grid用的少
3、发现各种浏览器之间兼容不太好,谷歌和火狐的显示有些差异。

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