博客列表 >表单注册页面与表格购物车的制作代码和部分代码讲解

表单注册页面与表格购物车的制作代码和部分代码讲解

BigPig
BigPig原创
2020年06月17日 19:57:40952浏览

表格购物车制作代码与部分标签讲解

  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>Document</title>
  7. <style>
  8. table {
  9. /* 清空表格之间的间隙 */
  10. border-collapse: collapse;
  11. /* 设置容器与容器之间的编剧,并且自动左右居中 */
  12. margin: 0 auto;
  13. /* 文字在表格内的内容居中显示 */
  14. text-align: center;
  15. width: 70%;
  16. }
  17. th,
  18. td {
  19. /* 设置表格的线条为1px 实线 颜色 */
  20. border-bottom: 1px solid #c2c0c0;
  21. /* 设置文字与表格内的内边距 */
  22. padding: 10px;
  23. /* 设置字体的宽度 */
  24. font-weight: lighter;
  25. }
  26. th {
  27. background-color: #B0C4DE;
  28. }
  29. tbody tr:hover {
  30. background-color: #F5F5F5;
  31. }
  32. tfoot td {
  33. border-bottom: none;
  34. color: red;
  35. font-size: 1.2rem;
  36. }
  37. button {
  38. /* 设置按钮于右边父容器的距离 */
  39. margin-right: 10px;
  40. border: none;
  41. width: 100px;
  42. height: 30px;
  43. /* 让按钮向右漂浮 */
  44. float: right;
  45. color: white;
  46. background-color: #87CEFA;
  47. ;
  48. }
  49. button:hover {
  50. width: 120px;
  51. height: 35px;
  52. }
  53. </style>
  54. </head>
  55. <body>
  56. <table>
  57. <!-- 表格的标题 -->
  58. <caption style="mask-border: 15px;font-size: 1.45rem;color: #B0C4DE;">
  59. 购物车
  60. </caption>
  61. <!-- 表格的头部份 -->
  62. <thead>
  63. <!-- tr决定了一个表格部分里有多个个行,td决定了一个表格里有多个列,th是表头,与td相比多了两个样式。 -->
  64. <tr>
  65. <th>商品名称</th>
  66. <th>商品编码</th>
  67. <th>商品数量</th>
  68. <th>商品单价</th>
  69. <th>商品总价</th>
  70. </tr>
  71. </thead>
  72. <!-- 表格的主体部分 -->
  73. <tbody>
  74. <tr>
  75. <td>华硕飞行堡垒7代</td>
  76. <td>UT-1</td>
  77. <td>1</td>
  78. <td>6788</td>
  79. <td>6788</td>
  80. </tr>
  81. <tr>
  82. <td>努比亚红魔5G手机</td>
  83. <td>UT-2</td>
  84. <td>3</td>
  85. <td>3788</td>
  86. <td>11364</td>
  87. </tr>
  88. <tr>
  89. <td>黑鲨三代</td>
  90. <td>UT-3</td>
  91. <td>1</td>
  92. <td>2199</td>
  93. <td>2199</td>
  94. </tr>
  95. <tr>
  96. <td>青轴机械键盘</td>
  97. <td>UT-4</td>
  98. <td>1</td>
  99. <td>315</td>
  100. <td>315</td>
  101. </tr>
  102. <tr>
  103. <td>电竞游戏鼠标</td>
  104. <td>UT-5</td>
  105. <td>1</td>
  106. <td>150</td>
  107. <td>150</td>
  108. </tr>
  109. </tbody>
  110. <!-- 表格的尾部 -->
  111. <tfoot>
  112. <tr>
  113. <td colspan="4" align="right">总计:</td>
  114. <td align="left">20816</td>
  115. </tr>
  116. </tfoot>
  117. </table>
  118. <div style="width: 70%; margin: 10px auto;">
  119. <button>提交结算</button>
  120. </div>
  121. </body>
  122. </html>

表单制作注册页面代码与部分标签讲解

  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>Document</title>
  7. <style>
  8. fieldset {
  9. width: 30%;
  10. margin: 0 auto;
  11. border: 3px solid #AFEEEE;
  12. border-radius: 15px 30px 15px 30px;
  13. background-color: #AFEEEE;
  14. text-align: left;
  15. }
  16. input {
  17. border: none;
  18. }
  19. input::placeholder {
  20. font-size: 13px;
  21. }
  22. legend {
  23. width: 200px;
  24. font-size: large;
  25. text-align: center;
  26. border: 1px solid #AFEEEE;
  27. border-radius: 15px 30px 15px 30px;
  28. background-color: springgreen;
  29. }
  30. form div {
  31. margin-top: 10px;
  32. }
  33. button {
  34. display: block;
  35. margin: 20px auto;
  36. width: 100px;
  37. height: 30px;
  38. border: none;
  39. background-color: #AFEEEE;
  40. }
  41. button:hover {
  42. width: 110px;
  43. height: 35px;
  44. cursor: pointer;
  45. color: white;
  46. }
  47. .ptl {
  48. text-align: left;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div>
  54. <!-- 这是一个表单标签 -->
  55. <form>
  56. <!-- 表示一个控件组 -->
  57. <fieldset>
  58. <!-- 控件组的标题 -->
  59. <legend>注册信息(必填)</legend>
  60. <div>
  61. <!-- 点击文字即可和绑定id的控件获取焦点 -->
  62. <label for="mu-username">账号:</label>
  63. <!-- type="text"表示是一个文本格式的输入框 -->
  64. <input type="text" id="mu-username" name="username" placeholder="账户需由4-10位英文加数字 autofocus">
  65. </div>
  66. <div>
  67. <label for="">邮箱:</label>
  68. <!-- type="email"这是一个邮箱格式的输入框 -->
  69. <input type="email" name="email" id="email-id" placeholder="请输入邮箱">
  70. </div>
  71. <div>
  72. <label for="psd-1">密码:</label>
  73. <!-- type="password"表示这是一个密码域 -->
  74. <input type="password" id="psd-1" name="password-1" placeholder="请您输入密码">
  75. </div>
  76. <div>
  77. <label for="pad-2">确定:</label>
  78. <input type="password" id="pad-2" name="password-20" placeholder="确定密码">
  79. </div>
  80. </fieldset>
  81. <fieldset style="margin-top: 30px;">
  82. <legend>扩展信息(选填)</legend>
  83. <div>
  84. <label for="">生日:</label>
  85. <!-- type="date"是一个时间选择,一般作用于获取出生年月日 -->
  86. <input type="date" name="birthday">
  87. </div>
  88. <div>
  89. <label for="secret">性别:</label>
  90. <label for="male"></label>
  91. <!-- type="radio"表示这个控件是一个单选按钮,只能选择一个 -->
  92. <input type="radio" name="gender" value="male" id="male">
  93. <label for="female"></label>
  94. <input type="radio" name="gender" value="female" id="female">
  95. <label for="secret">保密</label>
  96. <input type="radio" name="gender" value="secret" id="secret">
  97. </div>
  98. <div>
  99. <!-- type="checkbox"是一个复选按钮,可以选择多个 -->
  100. <label>爱好:</label>
  101. <label for="game">打游戏</label>
  102. <input type="checkbox" name="hobby[]" id="game" value="game">
  103. <label for="shoot">摄影</label>
  104. <input type="checkbox" name="hobbyp[]" id="shoot" value="shoot">
  105. <label for="progarmme">编程</label>
  106. <input type="checkbox" name="hobby[]" id="progarmme" value="progarmme">
  107. </div>
  108. <div>
  109. <label for="brand">手机:</label>
  110. <!-- type="search"表示这是一个下拉菜单 -->
  111. <input type="search" list="phone" name="brand" id="brand">
  112. <datalist id="phone">
  113. <option value="apple">苹果</option>
  114. <option value="huawei" label="华为"></option>
  115. <option value="mi" label="小米"> </option>
  116. </datalist>
  117. </div>
  118. </fieldset>
  119. <fieldset style="margin-top: 30px;">
  120. <legend>头像与个性签名</legend>
  121. <div>
  122. <label for="uploads">上传头像</label>
  123. <!-- type="file"是文件域,一般用于上传文件 -->
  124. <input type="file" name="user_pic" id="uploads" accept="image/png, image/jpeg, image/gif">
  125. </div>
  126. <div>
  127. <label for="resume">简历:</label>
  128. <!-- textarea标签是一个文本域,可以理解为是多个文本框合在一起的 -->
  129. <textarea name="resume" id="resume" cols="30" rows="5" placeholder="不超过100字"></textarea>
  130. </div>
  131. </div>
  132. </fieldset>
  133. </form>
  134. <button class="btn">提交</button>
  135. </div>
  136. </body>
  137. </html>


以上便是表单注册部分的代码与效果图!

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