The <table>
element can be sectioned into three horizontal parts:
<thead>
, <tbody>
, and <tfoot>
.
<thead>
contains the rows at the head of the <table>
.<tbody>
contains the rows in the body of the <table>
.<tfoot>
contains the rows at the foot of the <table>
.Using <thead>
, <tbody>
,
and <tfoot>
elements with the <table>
element tells browsers
the breakdown of the sections and allows you to apply different styles to the heading, body, and
footer.
<tbody> |
Yes | Yes | Yes | Yes | Yes |
All attributes are deprecated in HTML5.
Attribute | Value | Description |
---|---|---|
align | right left center justify char |
Not supported in HTML5. Aligns the content inside the <tbody> element |
char | character | Not supported in HTML5. Aligns the content inside the <tbody> element to a character |
charoff | number | Not supported in HTML5. Sets the length of characters the tbody content will be aligned from the character in the char attribute |
valign | top middle bottom baseline |
Not supported in HTML5. Vertical aligns the content |
The <tbody> tag supports the Global Attributes in HTML.
The <tbody> tag supports the Event Attributes in HTML.
tbody { display: table-row-group; vertical-align: middle; border-color: inherit; }
A demo showing how to use <tbody> tag.
<html>
<body>
<table>
<thead>
<td>This cell is in the thead rows group.</td>
<td>This cell is in the thead rows group.</td>
<td>This cell is in the thead rows group.</td>
</thead>
<tbody>
<tr>
<td>This cell is in the tbody rows group.</td>
<td>This cell is in the tbody rows group.</td>
<td>This cell is in the tbody rows group.</td>
</tr>
<tr>
<td>This cell is in the tbody rows group.</td>
<td>This cell is in the tbody rows group.</td>
<td>This cell is in the tbody rows group.</td>
</tr>
</tbody>
<tfoot>
<td>This cell is in the tfoot rows group.</td>
<td>This cell is in the tfoot rows group.</td>
<td>This cell is in the tfoot rows group.</td>
</tfoot>
</table>
</body><!--from w w w. java 2s.co m-->
</html>