表格标签使用

  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="500">
  11. <caption>
  12. 饮料库存信息表
  13. </caption>
  14. <thead>
  15. <tr>
  16. <th>id</th>
  17. <th>名称</th>
  18. <th>价格</th>
  19. <th>数量</th>
  20. <th>金额</th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. <tr align="center" bgcolor="yellow">
  25. <td>1</td>
  26. <td rowspan="2">绿茶和红茶</td>
  27. <td>3</td>
  28. <td>30</td>
  29. <td>90</td>
  30. </tr>
  31. <tr align="center" bgcolor="yellow">
  32. <td>2</td>
  33. <td>3</td>
  34. <td>20</td>
  35. <td>60</td>
  36. </tr>
  37. <tr align="center" bgcolor="yellow">
  38. <td>3</td>
  39. <td>阿萨姆</td>
  40. <td>5</td>
  41. <td>10</td>
  42. <td>50</td>
  43. </tr>
  44. <tr align="center" bgcolor="yellow">
  45. <td>4</td>
  46. <td>茉莉花茶</td>
  47. <td>3</td>
  48. <td>25</td>
  49. <td>75</td>
  50. </tr>
  51. <tr align="center" bgcolor="yellow">
  52. <td>5</td>
  53. <td>矿泉水</td>
  54. <td>1</td>
  55. <td>30</td>
  56. <td>30</td>
  57. </tr>
  58. </tbody>
  59. <tfoot>
  60. <tr align="center">
  61. <td colspan="2">总计</td>
  62. <td>15</td>
  63. <td>115</td>
  64. <td>305</td>
  65. </tr>
  66. </tfoot>
  67. </table>
  68. </body>
  69. </html>