Blogger Information
Blog 2
fans 0
comment 0
visits 977
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
制作表格、表单
圈圈侠
Original
621 people have browsed it

课程表

运行效果图:

代码:

  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. <style>
  8. th {
  9. background-color: rgb(255, 0, 157);
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <!-- 表格元素table 表格的边框cellspacing 表格内容与边框的间距cellpadding-->
  15. <table
  16. border="1"
  17. cellspacing="0"
  18. cellpadding="5"
  19. width="500"
  20. style="text-align: center;"
  21. >
  22. <!-- 表头 -->
  23. <thead>
  24. <tr>
  25. <!-- th是td的升级版,添加了加粗和剧中效果 -->
  26. <th></th>
  27. <th>星期一</th>
  28. <th>星期二</th>
  29. <th>星期三</th>
  30. <th>星期四</th>
  31. <th>星期五</th>
  32. </tr>
  33. </thead>
  34. <!-- 表的主体 -->
  35. <tbody>
  36. <tr>
  37. <!-- 单元格垂直合并rowspan,只能放在td中 -->
  38. <td rowspan="4" style="color: red;">上午</td>
  39. <td>升旗</td>
  40. <td>数学</td>
  41. <td>语文</td>
  42. <td>英语</td>
  43. <td>物理</td>
  44. </tr>
  45. <tr>
  46. <td>升旗</td>
  47. <td>数学</td>
  48. <td>语文</td>
  49. <td>英语</td>
  50. <td>物理</td>
  51. </tr>
  52. <tr>
  53. <td>语文</td>
  54. <td>体育</td>
  55. <td>政治</td>
  56. <td>历史</td>
  57. <td>化学</td>
  58. </tr>
  59. <tr>
  60. <td>语文</td>
  61. <td>体育</td>
  62. <td>政治</td>
  63. <td>历史</td>
  64. <td>化学</td>
  65. </tr>
  66. <tr>
  67. <!-- 单元格垂直合并rowspan,只能放在td中 -->
  68. <td rowspan="4" style="color: red;">下午</td>
  69. <td>英语</td>
  70. <td>历史</td>
  71. <td>信息</td>
  72. <td>语文</td>
  73. <td>英文</td>
  74. </tr>
  75. <tr>
  76. <td>英语</td>
  77. <td>历史</td>
  78. <td>信息</td>
  79. <td>语文</td>
  80. <td>英文</td>
  81. </tr>
  82. <tr>
  83. <td>数学</td>
  84. <td>物理</td>
  85. <td>数学</td>
  86. <td>数学</td>
  87. <td rowspan="2">周会</td>
  88. </tr>
  89. <tr>
  90. <td>数学</td>
  91. <td>物理</td>
  92. <td>数学</td>
  93. <td>数学</td>
  94. </tr>
  95. <tr>
  96. <!-- 单元格水平合并clospan,只能放在td中 -->
  97. <td colspan="6">
  98. 好好学习,天天向上
  99. </td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. </body>
  104. </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>注册表单</title>
  7. </head>
  8. <body>
  9. <h3>注册</h3>
  10. <!-- 表单元素 -->
  11. <form action="">
  12. <!-- 单行文本框text
  13. id绑定for实现点击姓名即可输入
  14. 提示文字placeholder
  15. 必填项required
  16. 自动获取焦点autofocus
  17. -->
  18. <div>
  19. <label for="name">姓名:</label>
  20. <input
  21. id="name"
  22. type="text"
  23. value=""
  24. placeholder="请输入姓名"
  25. required
  26. autofocus
  27. />
  28. </div>
  29. <!-- 密码控件password -->
  30. <div>
  31. <label for="password">密码:</label>
  32. <input
  33. id="password"
  34. type="password"
  35. value=""
  36. placeholder="请输入密码"
  37. required
  38. />
  39. </div>
  40. <!--单选按钮radio, 单选按钮name属性必须一致,默认属性checked -->
  41. <div>
  42. <label for="secret">性别:</label>
  43. <input id="" type="radio" name="gender" /><label for=""></label>
  44. <input id="" type="radio" name="gender" /><label for=""></label>
  45. <input id="secret" type="radio" name="gender" checked /><label
  46. for="secret"
  47. >保密</label
  48. >
  49. </div>
  50. <!-- 复选框 -->
  51. <div>
  52. <label for="">爱好:</label>
  53. <!-- 因为复选框会返回多个值,所以name属性应该使用数组的方式 -->
  54. <input type="checkbox" name="hobby[]" id="news" checked /><label
  55. for="news"
  56. >新闻</label
  57. >
  58. <input type="checkbox" name="hobby[]" id="drama" /><label for="drama"
  59. >戏剧</label
  60. >
  61. <input type="checkbox" name="hobby[]" id="game" checked /><label
  62. for="game"
  63. >游戏</label
  64. >
  65. </div>
  66. <!-- 上传文件file -->
  67. <div>
  68. <label for="user_img">头像:</label>
  69. <input id="user_img" type="file" name="user_img" />
  70. <!-- 隐藏域hidden 此属性规定对元素进行隐藏,隐藏的元素不会被显示
  71. 限制上传文件大小8288608byte=8M
  72. -->
  73. <input type="hidden" name="MAX_FILE_SIZE" value="8388608" />
  74. <!-- 用户ID一般通过隐藏域发送到服务器 -->
  75. <input type="hidden" name="user_id" value="1010" />
  76. </div>
  77. <!-- 下拉列表/预定义复选框 -->
  78. <div>
  79. <label for="user_source">来源:</label>
  80. <!-- 将文本框与下拉列表进行绑定list -->
  81. <input id="user_source" type="text" list="source" />
  82. <datalist id="source">
  83. <option value="网络">网络</option>
  84. <option value="介绍">介绍</option>
  85. <option value="其他">其他</option>
  86. </datalist>
  87. </div>
  88. <!-- 单选下拉框 -->
  89. <div>
  90. <label for="user_edu">学历:</label>
  91. <!-- 事件属性:用on开始跟一个事件名称,它的值是js的表达式 -->
  92. <select name="edu" id="user_edu" oninput="alert(this.value)">
  93. <option value="初中">初中</option>
  94. <!-- selected: 设置默认值 -->
  95. <option value="高中" selected>高中</option>
  96. <option value="大学">大学</option>
  97. <option value="研究生">研究生</option>
  98. <option value="其他">其他</option>
  99. </select>
  100. </div>
  101. <!-- 日期选择框 -->
  102. <div>
  103. <label for="brithday">生日:</label>
  104. <input id="brithday" type="date" />
  105. </div>
  106. <!-- 邮箱 -->
  107. <div>
  108. <label for="email">电子邮箱:</label>
  109. <input id="email" type="email" placeholder="445627221@qq.com" />
  110. </div>
  111. <!-- 年龄 -->
  112. <div>
  113. <label for="age">年龄:</label>
  114. <!-- 最小值18,最大值60,每次增加或减少5,默认值18 -->
  115. <input id="age" type="number" min="18" max="60" step="5" value="18" />
  116. </div>
  117. <!-- 调色板 -->
  118. <div>
  119. <label for="pick_color">喜欢的颜色是:</label>
  120. <input type="color" name="pick_color" />
  121. </div>
  122. <div>
  123. <button>提交</button>
  124. </div>
  125. </form>
  126. </body>
  127. </html>
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