Represents the body of a <table> element. | HTML 4, 4.01, 5 |
HTML Syntax
<table>
<tbody>
...
</tbody>
...
</table>
The <tbody
> element encapsulates a set of table rows that comprise the body of a parent <table> element.
Its content represents the table’s main data.
The <tbody
> is exposed for all tables, even if the table did not explicitly define a tbody element.
NOTE: This element can only be used within a <table
> element.
A <tbody
> element’s start tag can be omitted if the first thing inside the <tbody
> element is a <tr> element, and if the element is not immediately preceded by a <tbody
>, <thead>, or <tfoot> element whose end tag has been omitted.
A <tbody
> element’s end tag can be omitted if the <tbody
> element is immediately followed by a <tbody
> or <tfoot
> element, or if there is no more content in the parent element.
The <tbody>
element has no attribute of its own, but supports global attributes common to all HTML elements.
This example shows the relationship between the thead, tbody and tfoot elements, and how using CSS can illustrate their roles in the table model.
Sample Code
Invoice |
Product Name |
Quantity |
Unit Price |
Discount |
Net Amount |
10643 |
Rössle Sauerkraut |
15 |
$45.60 |
0.25 |
$513.00 |
10643 |
Chartreuse verte |
21 |
$18.00 |
0.25 |
$283.50 |
10643 |
Spegesild |
2 |
$12.00 |
0.25 |
$18.00 |
Totals |
$814.50 |
Invoice | Product Name | Quantity | Unit Price | Discount | Net Amount |
10643 | Rössle Sauerkraut | 15 | $45.60 | 0.25 | $513.00 |
10643 | Chartreuse verte | 21 | $18.00 | 0.25 | $283.50 |
10643 | Spegesild | 2 | $12.00 | 0.25 | $18.00 |
Totals |
$814.50 |
TABLE TD TFOOT THEAD TH TR Using Tables