HTML <tbody>
Tag
Example
HTML table with <thead>
, <tfoot>
, and <tbody>
elements:
Browser Support
All major browsers support the <tbody>
tag.
Tag Definition and Usage
The <tbody>
tag is used to group the body content in an HTML table.
The <tbody>
element should be used in conjunction with the <thead>
and <tfoot>
elements to specify each part of the table (body, header, footer).
Using these elements enables browsers to support scrolling of the table body independently of the header and footer. When printing a large table that spans multiple pages, the header and footer can be printed on each page that contains table data.
The <tbody>
tag must be used in the following context: as a child of the <table>
element, following the <caption>
, <colgroup>
, and <thead>
elements.
Tips and Notes
Note: The <tbody>
element must contain one or more <tr>
tags.
Tip: The <thead>
, <tbody>
, and <tfoot>
elements do not affect the layout of the table by default. However, you can use CSS to style these elements and change the appearance of the table.
Differences Between HTML 4.01 and HTML5
In HTML5, all attributes of the <tbody>
tag from HTML 4.01 are no longer supported.
Attributes
Attribute | Value | Description |
---|---|---|
align | right <br>left <br>center <br>justify <br>char | HTML5 does not support. Defines the alignment of the content within the <tbody> element. |
char | character | HTML5 does not support. Specifies the character to align the content within the <tbody> element. |
charoff | number | HTML5 does not support. Specifies the offset of the first aligned character in the <tbody> element. |
valign | top <br>middle <br>bottom <br>baseline | HTML5 does not support. Specifies the vertical alignment of the content within the <tbody> element. |
Global Attributes
The <tbody>
tag supports HTML's global attributes.
Event Attributes
The <tbody>
tag supports HTML's event attributes.