博客列表 >表格实现购物车及表单实现

表格实现购物车及表单实现

leverWang
leverWang原创
2020年06月17日 17:59:121407浏览

购物车

效果图

  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>Document</title>
  6. <style>
  7. table {
  8. text-align: center;
  9. width: 50%;
  10. margin: 0 auto;
  11. border-collapse: collapse;
  12. }
  13. table>caption {
  14. margin-bottom: 20px;
  15. font-size: 1.5rem;
  16. }
  17. th,
  18. td {
  19. border-bottom: 1px solid rgb(99, 99, 99);
  20. padding: 10px 0;
  21. color: #4e4e4e;
  22. font-weight: lighter;
  23. }
  24. tbody>tr:nth-last-of-type(2n) {
  25. background: rgba(194, 194, 194, .2);
  26. }
  27. tbody>tr:hover {
  28. background: lightpink;
  29. }
  30. table>thead {
  31. background: rgba(0, 129, 168, .1);
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <table>
  37. <caption>清单</caption>
  38. <thead>
  39. <tr>
  40. <th>ID</th>
  41. <th>商品名称</th>
  42. <th>数量</th>
  43. <th>价格</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <tr>
  48. <td>1</td>
  49. <td>罗技(Logitech)M185</td>
  50. <td>1</td>
  51. <td>59</td>
  52. </tr>
  53. <tr>
  54. <td>2</td>
  55. <td>罗技(Logitech)MK275</td>
  56. <td>1</td>
  57. <td>100</td>
  58. </tr>
  59. <tr>
  60. <td>3</td>
  61. <td>技嘉(GIGABYTE)RTX2070</td>
  62. <td>1</td>
  63. <td>6600</td>
  64. </tr>
  65. <tr>
  66. <td>4</td>
  67. <td>戴尔(DELL)U2720QM</td>
  68. <td>1</td>
  69. <td>4200</td>
  70. </tr>
  71. <tr>
  72. <td>5</td>
  73. <td>英特尔(Intel)i9-10900K</td>
  74. <td>1</td>
  75. <td>4499</td>
  76. </tr>
  77. </tbody>
  78. <tfoot>
  79. <tr>
  80. <td colspan="2">总计:</td>
  81. <td>5</td>
  82. <td>15517</td>
  83. </tr>
  84. </tfoot>
  85. </table>
  86. </body>
  87. </html>

表单实现

效果图

  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>Document</title>
  6. <style>
  7. * {
  8. padding: 0;
  9. margin: 0;
  10. }
  11. .reg {
  12. width: 30%;
  13. margin: 0 auto;
  14. background: #e6e6e6;
  15. border-radius: 10px;
  16. margin-top: 30px;
  17. }
  18. h1 {
  19. font: 1.2rem;
  20. padding: 10px;
  21. display: block;
  22. text-align: center;
  23. color: #FFF;
  24. background: #008079;
  25. border-radius: 5px 5px 0px 0px;
  26. border-bottom: 1px solid #89AF4C;
  27. margin-bottom: 20px;
  28. }
  29. input,
  30. button {
  31. outline: none;
  32. }
  33. textarea {
  34. width: 100%;
  35. border: 1px solid #e6e6e6;
  36. margin-bottom: 15px;
  37. border-radius: 5px;
  38. padding-left: 10px;
  39. margin-top: 10px;
  40. padding-top: 15px;
  41. }
  42. input[type="search"],
  43. input[type="email"],
  44. input[type="text"] {
  45. width: 80%;
  46. height: 40px;
  47. line-height: 40px;
  48. border: 1px solid #e6e6e6;
  49. margin-bottom: 15px;
  50. border-radius: 5px;
  51. padding-left: 10px;
  52. }
  53. textarea:focus,
  54. input[type="search"]:focus,
  55. input[type='email']:focus,
  56. input[type='text']:focus {
  57. border-color: #66afe9;
  58. outline: 0;
  59. box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
  60. }
  61. .reg-form {
  62. padding: 20px;
  63. }
  64. label>span {
  65. display: inline-block;
  66. width: 84px;
  67. }
  68. .radio_type {
  69. width: 20px;
  70. height: 20px;
  71. appearance: none;
  72. position: relative;
  73. }
  74. .radio_type:before {
  75. content: '';
  76. width: 20px;
  77. height: 20px;
  78. display: inline-block;
  79. border-radius: 50%;
  80. }
  81. .radio_type:checked:before {
  82. content: '';
  83. width: 20px;
  84. height: 20px;
  85. border: 1px solid #008079;
  86. background: #008079;
  87. display: inline-block;
  88. border-radius: 50%;
  89. vertical-align: middle;
  90. }
  91. .radio_type:checked:after {
  92. content: '';
  93. width: 10px;
  94. height: 5px;
  95. border: 2px solid white;
  96. border-top: transparent;
  97. border-right: transparent;
  98. text-align: center;
  99. display: block;
  100. position: absolute;
  101. top: 6px;
  102. left: 5px;
  103. vertical-align: middle;
  104. transform: rotate(-45deg);
  105. }
  106. .radio_type:checked+label {
  107. color: #008079;
  108. }
  109. .radio_type+label {
  110. line-height: 20px;
  111. display: inline-block;
  112. margin-left: 5px;
  113. margin-right: 15px;
  114. color: #333;
  115. }
  116. .mb15 {
  117. margin-bottom: 15px;
  118. }
  119. input[type="checkbox"] {
  120. width: 20px;
  121. height: 20px;
  122. }
  123. button,
  124. input[type="submit"],
  125. input[type="reset"] {
  126. padding: 15px 30px;
  127. border: none;
  128. background: #008079;
  129. color: #fff;
  130. border-radius: 5px;
  131. margin-left: 15px;
  132. }
  133. .btn {
  134. text-align: center;
  135. }
  136. </style>
  137. </head>
  138. <body>
  139. <div class="reg">
  140. <h1>注册</h1>
  141. <form action="" method="post" class="reg-form">
  142. <label for="uname">
  143. <span> 账号:</span> <input type="text" id="uname" name="uname" placeholder="5-10位中文或字母" required>
  144. </label>
  145. <label for="pwd">
  146. <span> 密码:</span> <input type="text" id="pwd" name="pwd" placeholder="6-20位字母+数字" required>
  147. </label>
  148. <label for="repwd">
  149. <span> 确认密码:</span> <input type="text" id="repwd" name="repwd" placeholder="确认密码" required>
  150. </label>
  151. <label for="email">
  152. <span> 邮箱:</span> <input type="email" id="email" name="email" placeholder="example@example.com" required>
  153. </label>
  154. <div class="mb15">
  155. <label for="male"> <span>性别:</span></label>
  156. <input class="radio_type" type="radio" name="gender" value="1" id="male"> <label for="male"></label>
  157. <input class="radio_type" type="radio" name="gender" value="2" id="female"><label for="female "></label>
  158. </div>
  159. <div class="mb15">
  160. <label for="other"><span>爱好:</span></label>
  161. <input type="checkbox" name="checkboox[]" id="basketball" value="basketball"> <label for="basketball">篮球</label>
  162. <input type="checkbox" name="checkboox[]" id="shoot" value="shoot"> <label for="shoot">摄影</label>
  163. <input type="checkbox" name="checkboox[]" id="other" value="other"> <label for="other">其他</label>
  164. </div>
  165. <div class="mb15">
  166. <label for="brand"><span>手机品牌:</span> </label>
  167. <input type="search" list="phone" name="brand" id="brand">
  168. <datalist id="phone">
  169. <option value="apple">
  170. <option value="huawei">
  171. <option value="mi">
  172. </datalist>
  173. </div>
  174. <div class="mb15">
  175. <label for="upload"><span>头像上传:</span> </label>
  176. <input type="file" name="upload" id="upload" accept="image/png, image/jpeg, image/gif">
  177. </div>
  178. <div class="mb15">
  179. <p>
  180. <label for="birthday"><span>生日:</span></label>
  181. <input type="date" id="birthday" name="birthday">
  182. </p>
  183. </div>
  184. <div class="mb15">
  185. <label for="birthday"><span>简历:</span></label>
  186. <textarea name="resume" id="resume" cols="50" rows="10" placeholder="不超过100字"></textarea>
  187. </div>
  188. <div class="btn">
  189. <button>提交</button>
  190. <input type="submit" value="注册" name="submit">
  191. <input type="reset" value="重填" name="reset">
  192. </div>
  193. </form>
  194. </div>
  195. </body>
  196. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议