博客列表 >HTML+CSS 购物车(table)版

HTML+CSS 购物车(table)版

零龙
零龙原创
2020年06月24日 08:59:062164浏览

购物车table版


  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>购物车</title>
  7. </head>
  8. <style>
  9. *{
  10. margin: 0px auto;
  11. }
  12. .table{
  13. width: 70%;
  14. border-collapse: collapse;
  15. color: burlywood;
  16. font-weight: lighter;
  17. text-align: center;
  18. }
  19. table caption {
  20. font-size: 1.5rem;
  21. margin-bottom: 15px;
  22. color: green;
  23. }
  24. table thead th,
  25. table td{
  26. border-bottom: 1px solid #ccc;
  27. padding: 10px;
  28. }
  29. table th {
  30. font-weight: lighter;
  31. color: green;
  32. }
  33. table thead tr:first-of-type {
  34. background-color: rgb(195, 232, 233);
  35. }
  36. table tbody tr:nth-of-type(even) {
  37. background-color: rgb(241, 241, 225);
  38. }
  39. table tbody tr:hover {
  40. background-color: rgb(223, 223, 223);
  41. color: white;
  42. }
  43. table tfoot td {
  44. border-bottom: none;
  45. color: coral;
  46. font-size: 1.2rem;
  47. font-weight: bolder;
  48. }
  49. body div:last-of-type {
  50. width: 70%;
  51. margin: 10px auto;
  52. }
  53. body div:first-of-type button {
  54. float: right;
  55. width: 120px;
  56. height: 32px;
  57. background-color: seagreen;
  58. color: white;
  59. border: none;
  60. cursor: pointer;
  61. }
  62. body div:first-of-type button:hover {
  63. background-color: coral;
  64. font-size: 1rem;
  65. }
  66. </style>
  67. <body>
  68. <table class="table">
  69. <caption>购物车</caption>
  70. <thead>
  71. <tr>
  72. <th>序号</th>
  73. <th>品名</th>
  74. <th>单价</th>
  75. <th>数量</th>
  76. <th>金额</th>
  77. </tr>
  78. </thead>
  79. <colgroup>
  80. <col width="50" />
  81. <col width="250" />
  82. <col width="70" />
  83. <col width="60" />
  84. <col width="70" />
  85. </colgroup>
  86. <tbody>
  87. <tr>
  88. <td>1</td>
  89. <td>联想Thinkpad笔记本电脑</td>
  90. <td>3566</td>
  91. <td>1</td>
  92. <td>3566</td>
  93. </tr>
  94. <tr>
  95. <td>2</td>
  96. <td>雷柏机械键盘套装</td>
  97. <td>356</td>
  98. <td>1</td>
  99. <td>356</td>
  100. </tr>
  101. <tr>
  102. <td>3</td>
  103. <td>苹果MAC笔记本电脑</td>
  104. <td>14500</td>
  105. <td>1</td>
  106. <td>14500</td>
  107. </tr>
  108. <tr>
  109. <td>4</td>
  110. <td>奥迪A8 V12运动版</td>
  111. <td>1250000</td>
  112. <td>1</td>
  113. <td>1250000</td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <div>
  118. <button>结算</button>
  119. </div>
  120. </body>
  121. </html>

  • 实例效果图

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