Blogger Information
Blog 11
fans 0
comment 0
visits 10136
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
学习笔记:表格小知识
小杂鱼
Original
527 people have browsed it

表格规范与行列的合并

1.规范

  1. <table>
  2. <caption>标题</caption>
  3. <!-- 表头 -->
  4. <thead></thead>
  5. <!-- 表体 -->
  6. <tbody></tbody>
  7. <!-- 表尾 -->
  8. <tfoot></tfoot>
  9. </table>

2.合并

ps: 合并只能在 td / th 进行,不能在 tr 合并

行的合并

  1. <table>
  2. <caption>合并行演示</caption>
  3. <!-- 行的合并 属性:rowspan -->
  4. <!-- 合并多少行意味着从当前行到第几行都要减少当前列 例如:合并3行则从当前行开始到第3行都要减少当前列 -->
  5. <tbody>
  6. <tr>
  7. <td rowspan="3" bgcolor="blue">1</td>
  8. <td>2</td>
  9. <td>3</td>
  10. <td>4</td>
  11. <td>5</td>
  12. </tr>
  13. <tr>
  14. <!-- <td>1</td> -->
  15. <td>2</td>
  16. <td>3</td>
  17. <td>4</td>
  18. <td>5</td>
  19. </tr>
  20. <tr>
  21. <!-- <td>1</td> -->
  22. <td>2</td>
  23. <td>3</td>
  24. <td>4</td>
  25. <td>5</td>
  26. </tr>
  27. </tbody>
  28. </table>

列的合并

  1. <table>
  2. <caption>合并列演示</caption>
  3. <!-- 列的合并 属性:colspan -->
  4. <!-- 合并多少列意味着从当前列减少n-1列 例如合并2列则从当前列开始接下来减少1列 -->
  5. <tbody>
  6. <tr>
  7. <td>1</td>
  8. <td>2</td>
  9. <td>3</td>
  10. <td>4</td>
  11. <td>5</td>
  12. </tr>
  13. <tr>
  14. <td>1</td>
  15. <td>2</td>
  16. <td>3</td>
  17. <td>4</td>
  18. <td>5</td>
  19. </tr>
  20. <tr>
  21. <td>1</td>
  22. <td colspan="2" bgcolor="blue">2</td>
  23. <!-- <td>3</td> -->
  24. <td>4</td>
  25. <td>5</td>
  26. </tr>
  27. </tbody>
  28. </table>

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