Blogger Information
Blog 7
fans 0
comment 0
visits 12098
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
table表格的运用
A特权?&非凡群直播&社群裂变
Original
600 people have browsed it

1、 作业

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <table border="1" width="80%">
  11. <!-- 标题 -->
  12. <caption>
  13. 商品信息表
  14. </caption>
  15. <!-- 表头 -->
  16. <thead>
  17. <tr align="center">
  18. <td>ID</td>
  19. <td>品名</td>
  20. <td>价格</td>
  21. <td>数量</td>
  22. <td>金额</td>
  23. </tr>
  24. </thead>
  25. <!-- 表体 -->
  26. <tbody>
  27. <tr align="center" >
  28. <td>1</td>
  29. <td>方便面</td>
  30. <td colspan="3" bgcolor="yellow">1</td>
  31. <!-- <td>1</td>
  32. <td>1</td> -->
  33. </tr>
  34. <tr align="center">
  35. <td>2</td>
  36. <td>馒头</td>
  37. <td>2</td>
  38. <td rowspan="2" bgcolor="green">2</td>
  39. <td>4</td>
  40. </tr>
  41. <tr align="center">
  42. <td>3</td>
  43. <td>蔬菜</td>
  44. <td>3</td>
  45. <!-- <td>2</td> -->
  46. <td>6</td>
  47. </tr>
  48. </tbody>
  49. <!-- 表尾 -->
  50. <tfoot>
  51. <tr align="center">
  52. <td>汇总:</td>
  53. <td>3</td>
  54. <td></td>
  55. <td>5</td>
  56. <td>11</td>
  57. </tr>
  58. </tfoot>
  59. </table>
  60. </body>
  61. </html>

2、笔记

标准的table表格写法

  1. ```html
  2. <table border="1" width="80%">
  3. <!-- 标题 -->
  4. <caption>
  5. <!-- 标题内容-->
  6. </caption>
  7. <!-- 表头 -->
  8. <thead>
  9. <tr align="center">
  10. <td> </td>
  11. </tr>
  12. </thead>
  13. <!-- 表体 -->
  14. <tbody>
  15. <tr align="center" >
  16. <td>1</td>
  17. </tr>
  18. <tr align="center">
  19. <td>2</td>
  20. </tr>
  21. <tr >
  22. <td>3</td>
  23. </tr>
  24. </tbody>
  25. <!-- 可以有多个tbody -->
  26. <tbody>
  27. <tr align="center" >
  28. <td>1</td>
  29. </tr>
  30. <tr align="center">
  31. <td>2</td>
  32. </tr>
  33. <tr >
  34. <td>3</td>
  35. </tr>
  36. </tbody>
  37. <!-- 表尾 非必须 -->
  38. <tfoot>
  39. <tr>
  40. <td></td>
  41. </tr>
  42. </tfoot>
  43. </table>

```
table合并行和和并列的属性,属性必须用于单元格内,不能用于<tr>

rowspan可以用于行合并
colspan可以用于列合并

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
Author's latest blog post