Copyright © tutorialspoint.com

# HTML <tbody> tag

## Function:

The HTML <tbody> tag is used adding a body to a table. The tbody tag is used in conjunction with the thead tag and the tfoot tag in determining each part of the table (header, footer, body).

## Difference between HTML and XHTML:

NONE

## Example:

    <table border="1" width="100%">
    <thead>
    <tr>
    <td colspan="4">This is the head of the table</td>
    </tr>
    </thead>
    <tfoot>
    <tr>
    <td colspan="4">This is the foot of the table</td>
    </tr>
    </tfoot>
    <tbody>
    <tr>
    <td>Cell 1</td>
    <td>Cell 2</td>
    <td>Cell 3</td>
    <td>Cell 4</td>
    </tr>
    <tr>
    ...more rows here containing four cells...
    </tr>
    </tbody>
    <tbody>
    <tr>
    <td>Cell 1</td>
    <td>Cell 2</td>
    <td>Cell 3</td>
    <td>Cell 4</td>
    </tr>
    <tr>
    ...more rows here containing four cells...
    </tr>
    </tbody>
    </table>

This will produce following result:

This is the head of the table
This is the foot of the table
Cell 1 | Cell 2 | Cell 3 | Cell 4
...more rows here containing four cells...
Cell 1 | Cell 2 | Cell 3 | Cell 4
...more rows here containing four cells...

## Online Practice:

To Become more comfortable - Do Online Practice

## Attributes:

Attribute | Value | Description
--- | --- | ---
align | right left center justify char | Visual alignment.
char | character | Specifies which character to align text on. Used when align="char"
charoff | pixels or % | Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align="char"
valign | top middle bottom baseline | Vertical alignment.

## Standard Attributes:

Attribute | Description
--- | ---
class | Document wide identifier
dir | Specifies the direction of the text
id | Document wide identifier
title | Specifies a title to associate with the element.
style | Helps to include inline casecadubf style sheet.
lang | Sets the language code.
xml:lang | Sets the language code.

## Event Attributes:

Attribute | Description
--- | ---
onclick | Script runs when a mouse click
ondblclick | Script runs when a mouse double-click
onmousedown | Script runs when mouse button is pressed
onmouseup | Script runs when mouse button is released
onmouseover | Script runs when mouse pointer moves over an element
onmousemove | Script runs when mouse pointer moves
onmouseout | Script runs when mouse pointer moves out of an element
onkeypress | Script runs when key is pressed and released
onkeydown | Script runs when key is pressed
onkeyup | Script runs when key is released

Copyright © tutorialspoint.com