<tbody> elementThe <tbody> element groups the main body rows of a table. It contains the ordinary data rows, separate from any header or footer rows.
Inside <tbody>, each row is written with a <tr> element. Those rows usually contain <td> cells, though header cells can also appear where the table structure needs them.
A table can have more than one <tbody>. This is useful when the body data naturally falls into separate groups, such as months, categories, teams, or sections of results.
When parsing HTML with rows written directly inside <table>, the browser inserts a <tbody> in the document tree. This matters for CSS and scripts: table > tr will not select those rows, while table > tbody > tr will. Writing the group explicitly makes the source match that structure.
Place body groups after any <thead> and before any <tfoot>. Put cells inside rows, rather than directly inside <tbody>.
A body row can have a <th> as its row heading. In the example, each person's name labels the score in that row, so the names use scope="row".
Attributes: GLOBALS.
Typical layout: <table> <caption>Workshop scores</caption> <thead> <tr> <th scope="col">Name</th> <th scope="col">HTML</th> <th scope="col">CSS</th> </tr> </thead> <tbody> <tr> <th scope="row">Ada</th> <td>92</td> <td>88</td> </tr> <tr> <th scope="row">Lin</th> <td>85</td> <td>90</td> </tr> </tbody> </table>
Visual representation:
| Name | HTML | CSS |
|---|---|---|
| Ada | 92 | 88 |
| Lin | 85 | 90 |