HTML <tbody> tagS2C Home   « HTML <tbody> tag

Definition

The <tbody> tag is used to define group body information within a table and must be enclosed within the
<table></table> element.

The <tbody></tbody> element should only appear once within a table and follow the
<thead></thead> and <tfoot></tfoot> elements.

Example


<table>
  <thead>
    <tr>
      <th>Fruit</th>
      <th>Colour</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <td>Salad</td>
      <td>Rainbow</td>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>Banana</td>
      <td>Yellow</td>
    </tr>
    <tr>
      <td>Pea</td>
      <td>Green</td>
    </tr>
  </tbody>
</table>

Required Attributes

NONE

Optional Attributes

char no browser support - specifies character to align cells to.

charoff no browser support - specifies offset of char character in pixels.

align specifies the horizontal alignment of cell contents.


<tbody align="left"></tbody>   <!-- align content to the left -->
<tbody align="center"></tbody>   <!-- align content in the centre -->
<tbody align="right"></tbody>   <!-- align content to the right -->
<tbody align="justify"></tbody>   <!-- stretch contents to width -->
<tbody align="char"></tbody>   <!-- align content to a character -->

valign specifies the vertical alignment of cell contents.


<tbody valign="top"></tbody>   <!-- align content to the top -->
<tbody valign="middle"></tbody>   <!-- align content in the middle -->
<tbody valign="bottom"></tbody>   <!-- align content to the bottom -->
<tbody valign="baseline"></tbody>   <!-- align to bottom when different font sizes -->

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<tbody class="classname"></tbody>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<tbody id="idname"></tbody>

style - specifies an inline style for the element allowing you to apply the style to the content.


<tbody style="color:red;text-align:left"></tbody>

title - specifies extra information about the content.


<tbody title="information about the content"></tbody>

Language Attributes

dir - specifies the directional flow of the content.


<tbody dir="ltr"></tbody>   <!-- The text will flow from left to right -->

<tbody dir="rtl"></tbody>   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<tbody lang="en"></tbody>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<tbody xml:lang="fr"></tbody>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<tbody onkeydown="go()"></tbody>   <!-- Executes the go() function -->

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<tbody onkeypress="go()"></tbody>   <!-- Executes the go() function -->

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<tbody onkeyup="go()"></tbody>   <!-- Executes the go() function -->

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<tbody onclick="go()"></tbody>   <!-- Executes the go() function --> 

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<tbody ondblclick="go()"></tbody>   <!-- Executes the go() function -->

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<tbody onmousedown="go()"></tbody>   <!-- Executes the go() function -->

onmousemove - The JavaScript code to be run when the mouse button is moved.


<tbody onmousemove="go()"></tbody>   <!-- Executes the go() function -->

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<tbody onmouseout="go()"></tbody>   <!-- Executes the go() function -->

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<tbody onmouseover="go()"></tbody>   <!-- Executes the go() function -->

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<tbody onmouseup="go()"></tbody>   <!-- Executes the go() function -->

go to home page Homepage go to top of page Top