HTML Tags

HTML <tbody> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <tbody> (short for table body) element defines a table's body.

The <tbody> element is used to group a set of rows defining the main body of the table data. It must appears as a child of a <table> element, after any <caption>, <colgroup> and <thead> elements, and must contain at least one row, defined by the <tr> element.

The following table summarizes the usages context and the version history of this tag.

Parent: <table>
Content: <tr>
Start/End Tag: Start tag: required, End tag: required
Version: HTML 4, 4.01, 5

Usage Notes

  • Table rows may be grouped into a table head, table foot, and one or more table body sections, using the <thead>, <tfoot> and <tbody> tags, respectively.

  • This division enables the browser to support scrolling of table bodies independently of the table head and foot sections. Also, when long tables are printed that spans multiple pages, the table head and foot information may be printed on each page that contains table data.

  • When present, each <thead>, <tfoot> and <tbody> contains a row group. Each row group must contain at least one row, defined by the <tr> tag.


Syntax

The basic syntax of the <tbody> tag is given with:

HTML / XHTML: <tbody> ... </tbody>

The example below shows the <tbody> tag in action.

<table>
    <tbody>
        <tr>
            <td>1</td>
            <td>John Carter</td>
            <td>[email protected]</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Peter Parker</td>
            <td>[email protected]</td>
        </tr>
        <tr>
            <td>3</td>
            <td>John Rambo</td>
            <td>[email protected]</td>
        </tr>
    </tbody>
</table>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <tbody> tag.

Attribute Value Description
align left
right
center
justify
char
Obsolete Specifies the alignment of cell contents inside the tbody element.
char character Obsolete Sets the character to which cell contents of the related tbody element should align.
charoff number Obsolete Defines the number of characters by which cell contents of the related tbody element will be offset from the alignment characters specified by the char attribute.
valign top
middle
bottom
baseline
Obsolete Specifies the vertical alignment of content within each cell of the related tbody element.

Global Attributes

Like all other HTML tags, the <tbody> tag supports the global attributes in HTML5.


Event Attributes

The <tbody> tag also supports the event attributes in HTML5.


Browser Compatibility

The <tbody> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 5+

Further Reading

See tutorial on: HTML Tables.

Other table-related tags: <table>, <thead>, <tfoot>, <caption>, <colgroup>, <col>, <tr>, <th>, <td>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties