Advertisement

HTML <tbody> tag

Examples

HTML table with thead, tbody and tfoot elements:

<table border="1">
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>

  <tfoot>
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>

  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
</table>

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

<Tbody> tag only partly supported by all major browsers.

Definition and Usage

<Tbody> tag form the body (the body). The label for combining HTML table body content.

tbody element should thead and tfoot combine elements used together.

thead element is used for HTML table header content group, and tfoot element for HTML table table Note (footer) content are grouped.

NOTE: If you use the thead, tfoot and tbody elements, you must use all elements. Their order of appearance are: thead, tfoot, tbody, so the browser can receive all the data presented before the footer. You must use these tags within the table element.

Tip: By default, these elements will not affect the layout table. However, you can use CSS to make these elements affect the table's appearance.

A detailed description

thead, tfoot tbody elements and gives you the ability to group table rows. When you create a table, you might want to have a header row, some rows with data, and a total at the bottom line. This division allows browsers have the ability to support independent of the table header and footer text scrolling table. When long tables are printed, the table headers and footers can be printed on each page that contains table data.

Differences between HTML and XHTML

NONE

Tips and Notes:

NOTE: <thead> interior must have <tr> tag!

NOTE: <thead>, <tbody> and <tfoot> seldom used, because of bad browser support. We expect that this situation will change in future versions of XHTML. If you are using Internet Explorer 5.0 or later browser, you can view a tutorial in our XML example .

Optional attributes

Attributes value description
align
  • right
  • left
  • center
  • justify
  • char
Alignment is defined tbody element content.
char character According to the provisions of which character to align text.
charoff number The provisions of an offset alignment character.
valign
  • top
  • middle
  • bottom
  • baseline
Predetermined vertical alignment tbody element content.

Global Properties

<tbody> tag supports HTML in the global properties .

Event Properties

<tbody> tag supports HTML in the event properties .