Blogger Information
Blog 11
fans 0
comment 0
visits 8055
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
购物车仿写--PHP培训十期线上班
宋明杰
Original
606 people have browsed it

购物车仿写:

经过1个月左右的学习,不断的试错,总结,不停搜索脑海和百度里的各种属性代码,终于写出了 稍微 像样的购物车页面。

HTML代码:

  1. <body>
  2. <div class="gwc">
  3. <div class="gwc1">
  4. <a href="#"><img src="../img/logo.png"></a>
  5. <a href="#">购物车</a>
  6. <div class="sousuo">
  7. <input type="search" name="search" id="search">
  8. <label for="search">搜索</label>
  9. </div>
  10. </div>
  11. <div class="gwc2">
  12. <span class="gwc21">全部商品9</span>
  13. <div>
  14. <span class="gwc22">配送至:</span>
  15. <input type="search" value="四川省成都市高新区">
  16. </div>
  17. </div>
  18. <div class="gwc3">
  19. <input type="checkbox" name="checkbox" value=''>
  20. <span>全选</span>
  21. <span>商品</span>
  22. <span>单价</span>
  23. <span>数量</span>
  24. <span>小计</span>
  25. <span>操作</span>
  26. </div>
  27. <div class="gwc4">
  28. <input type="checkbox">
  29. <a><img src="../img/2.jpg" class="img1"></a>
  30. <a class="a1"><img src="../img/3.jpg" class="img2">洋河蓝色经典 梦之蓝M3 52度 礼盒装 500ml*2瓶白酒 口感绵柔浓香</a>
  31. <span>52度 M3礼盒装</span>
  32. <a class="a1">¥1099.00</a>
  33. <a><img src="../img/5.jpg" class="img2"></a>
  34. <span class="span1">¥1099.00</span>
  35. <a class="a1">删除</a>
  36. </div>
  37. <div class="gwc4">
  38. <input type="checkbox">
  39. <a><img src="../img/2.jpg" class="img1"></a>
  40. <a class="a1"><img src="../img/3.jpg" class="img2">洋河蓝色经典 梦之蓝M3 52度 礼盒装 500ml*2瓶白酒 口感绵柔浓香</a>
  41. <span>52度 M3礼盒装</span>
  42. <a class="a1">¥1099.00</a>
  43. <a><img src="../img/5.jpg" class="img2"></a>
  44. <span class="span1">¥1099.00</span>
  45. <a class="a1">删除</a>
  46. </div>
  47. <div class="gwc4">
  48. <input type="checkbox">
  49. <a><img src="../img/2.jpg" class="img1"></a>
  50. <a class="a1"><img src="../img/3.jpg" class="img2">洋河蓝色经典 梦之蓝M3 52度 礼盒装 500ml*2瓶白酒 口感绵柔浓香</a>
  51. <span>52度 M3礼盒装</span>
  52. <a class="a1">¥1099.00</a>
  53. <a><img src="../img/5.jpg" class="img2"></a>
  54. <span class="span1">¥1099.00</span>
  55. <a class="a1">删除</a>
  56. </div>
  57. <div class="gwc5">
  58. <input type="checkbox" name="checkbox" value=''>
  59. <span>全选</span>
  60. <a href="#">删除选中商品</a>
  61. <a href="#">移到关注</a>
  62. <a href="#" class="a1">清理购物车</a>
  63. <a href="#">已选择<b class="b1">0</b>件商品</a>
  64. <span>总价<b class="b2">¥0.00</b></span>
  65. <input type="submit" value='去结算' class="i1">
  66. </div>
  67. </div>
  68. </body>
  69. </html

CSS代码:

  1. @import "../zujian_reset.css";
  2. *{
  3. /*border: 1px solid blue;*/
  4. }
  5. .gwc{
  6. width: 1000px;
  7. margin: auto;
  8. }
  9. .gwc>.gwc1{
  10. display: flex;
  11. height: 60px;
  12. margin-top: 15px;
  13. }
  14. .gwc>.gwc1 a:nth-of-type(2) {
  15. font-size: 18px;
  16. color: #666666;
  17. height: 30px;
  18. align-self: end;
  19. }
  20. .gwc>.gwc1>.sousuo{
  21. display: flex;
  22. margin-left: auto;
  23. align-self: end;
  24. }
  25. .gwc>.gwc1>.sousuo input{
  26. width: 300px;
  27. height: 30px;
  28. /*border-color: red;*/
  29. /*border-width: 2px;*/
  30. border: 2px solid red;
  31. outline: none;
  32. }
  33. .gwc>.gwc1>.sousuo label{
  34. /*font-size: 23px;*/
  35. /*height: 500px;*/
  36. color: #e9e9e9;
  37. background: red;
  38. width: 50px;
  39. height: 30px;
  40. font-size: 13px;
  41. text-align: center;
  42. line-height: 30px;
  43. }
  44. .gwc>.gwc2{
  45. height: 30px;
  46. display: flex;
  47. justify-content: space-between;
  48. margin-top: 30px;
  49. /*margin-bottom: 10px;*/
  50. /*padding-bottom: 8px;*/
  51. }
  52. .gwc>.gwc2>.gwc21{
  53. color: red;
  54. font-weight: bold;
  55. border-bottom: 1px solid red;
  56. }
  57. .gwc>.gwc2>div>.gwc22{
  58. color: #333333;
  59. font-size: 12px;
  60. }
  61. .gwc>.gwc2>div>input{
  62. width: 160px;
  63. height: 22px;
  64. color: #969896;
  65. }
  66. .gwc>.gwc3{
  67. display: grid;
  68. background: #cccccc;
  69. height: 45px;
  70. grid-template: '1 2 3 4 5 6 7' 1fr
  71. /3% 10% 47% 9% 13% 9% 9%;
  72. place-items: center start;
  73. }
  74. .gwc>.gwc3 span{
  75. color: #333333;
  76. font-size: 12px;
  77. margin-left: 15px;
  78. }
  79. .gwc>.gwc3 input{
  80. place-self: center;
  81. }
  82. .gwc>.gwc4{
  83. display: grid;
  84. background: #ffffff;
  85. border-top: 1px solid #999999;
  86. height: 130px;
  87. grid-template: '1 2 3 4 5 6 7 8' 1fr
  88. /3% 12% 33% 12% 9% 13% 9% 9%;
  89. place-items: start;
  90. padding-top: 15px;
  91. }
  92. .gwc>.gwc4 .img1{
  93. width: 100px;
  94. height: 100px;
  95. border: 1px solid #999999;
  96. margin-left: 10px;
  97. }
  98. .gwc>.gwc4 input{
  99. place-self: start center;
  100. }
  101. .gwc>.gwc4 .img2{
  102. width: 60px;
  103. height: 17px;
  104. }
  105. .gwc>.gwc4>.a1{
  106. color: #333333;
  107. font-size: 12px;
  108. margin-left: 10px;
  109. }
  110. .gwc>.gwc4 span{
  111. color: #333333;
  112. font-size: 12px;
  113. margin-left: 10px;
  114. /*: 1em;*/
  115. }
  116. .gwc>.gwc4>.span1{
  117. font-weight: bold;
  118. font-size:15px;
  119. }
  120. .gwc>.gwc5{
  121. display: grid;
  122. background: #cccccc;
  123. margin-top: 15px;
  124. height: 55px;
  125. grid-template: '1 2 3 4 5 7 8 9' 1fr
  126. /3% 3% 8% 5% auto 10% 8% 10%;
  127. place-items: center start;
  128. }
  129. .gwc>.gwc5 input{
  130. place-self: center;
  131. }
  132. .gwc>.gwc5 a{
  133. font-size: 11px;
  134. color: #666;
  135. }
  136. .gwc>.gwc5 span{
  137. font-size: 11px;
  138. color: #666;
  139. }
  140. .gwc>.gwc5 .a1{
  141. font-size: 12px;
  142. color: #444;
  143. font-weight: bold;
  144. }
  145. .gwc>.gwc5 .b1{
  146. color: red;
  147. font-size: 13px;
  148. }
  149. .gwc>.gwc5 .b2{
  150. color: red;
  151. font-size: 18px;
  152. font-weight: bolder;
  153. }
  154. .gwc>.gwc5 .i1{
  155. height: 55px;
  156. width: 90px;
  157. place-self: end;
  158. background: red;
  159. color: #ffffff;
  160. font-size: 16px;
  161. border: none;
  162. }

运行结果截图:

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:购物车, 简单以假乱真了, 非常棒
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!