Blogger Information
Blog 12
fans 0
comment 0
visits 5746
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1017作业:表格实战
PHP是世界上最好的语言
Original
496 people have browsed it

实现一个课程表,使用了行和列的合并操作。

代码

css

  1. <style>
  2. #time-table, th, td{
  3. border: solid gray 2px;
  4. text-align: center;
  5. }
  6. #time-table p {
  7. margin: 2px;
  8. }
  9. tfoot th, tfoot td {
  10. border: none;
  11. }
  12. </style>

html

  1. <table id="time-table">
  2. <caption><h2>课程表</h2></caption>
  3. <thead>
  4. <tr>
  5. <th colspan="2">节次\星期</th>
  6. <th>星期一</th>
  7. <th>星期二</th>
  8. <th>星期三</th>
  9. <th>星期四</th>
  10. <th>星期五</th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. <tr>
  15. <td colspan="7" style="background-color: lightgray;">
  16. <p style="margin: 2;">早自习</p>
  17. <p style="margin: 2;">07:00 - 07:50</p>
  18. </td>
  19. </tr>
  20. <tr>
  21. <th rowspan="4">上午</th>
  22. <th>
  23. <p>第一节</p>
  24. <p>08:00 - 08:40</p>
  25. </th>
  26. <td>语文</td>
  27. <td>数学</td>
  28. <td>英语</td>
  29. <td>化学</td>
  30. <td>物理</td>
  31. </tr>
  32. <tr>
  33. <th>
  34. <p>第二节</p>
  35. <p>08:50 - 09:30</p>
  36. </th>
  37. <td>语文</td>
  38. <td>数学</td>
  39. <td>英语</td>
  40. <td>化学</td>
  41. <td>物理</td>
  42. </tr>
  43. <tr>
  44. <th>
  45. <p>第三节</p>
  46. <p>09:40 - 10:20</p>
  47. </th>
  48. <td>语文</td>
  49. <td>数学</td>
  50. <td>英语</td>
  51. <td>化学</td>
  52. <td>物理</td>
  53. </tr>
  54. <tr>
  55. <th>
  56. <p>第四节</p>
  57. <p>10:30 - 11:20</p>
  58. </th>
  59. <td>语文</td>
  60. <td>数学</td>
  61. <td>英语</td>
  62. <td>化学</td>
  63. <td>物理</td>
  64. </tr>
  65. <tr>
  66. <td colspan="7" style="background-color: lightgray;">
  67. <p>午休</p>
  68. <p>12:00 - 14:00</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <th rowspan="3">上午</th>
  73. <th>
  74. <p>第五节</p>
  75. <p>14:00 - 14:40</p>
  76. </th>
  77. <td>语文</td>
  78. <td>数学</td>
  79. <td>英语</td>
  80. <td>化学</td>
  81. <td>物理</td>
  82. </tr>
  83. <tr>
  84. <th>
  85. <p>第六节</p>
  86. <p>14:50 - 15:30</p>
  87. </th>
  88. <td>语文</td>
  89. <td>数学</td>
  90. <td>英语</td>
  91. <td>化学</td>
  92. <td>物理</td>
  93. </tr>
  94. <tr>
  95. <th>
  96. <p>第七节</p>
  97. <p>15:40 - 16:40</p>
  98. </th>
  99. <td>语文</td>
  100. <td>数学</td>
  101. <td>英语</td>
  102. <td>化学</td>
  103. <td>物理</td>
  104. </tr>
  105. <td colspan="7" style="background-color: lightgray;">
  106. <p>晚自习</p>
  107. <p>19:00 - 21:50</p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. <tfoot>
  112. <tr>
  113. <!-- 水平方向合并/列合并 : colspan -->
  114. <th colspan="2">课程表有效期:</th>
  115. <td colspan="5">2022年10月1日-2023年5月1日</td>
  116. </tr>
  117. </tfoot>
  118. </table>

效果

Correcting teacher:PHPzPHPz

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