NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<tbody> (Table Body)


This element is used to group the rows within the body of a table so that common alignment and style defaults can easily be set for numerous cells.

Standard Syntax


<tbody
align="center | char | justify | left | right"
char="character"
charoff="offset"
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
valign="baseline | bottom | middle | top"
tr elements only
</tbody>

Attributes Defined by Internet Explorer


accesskey="key" (5.5)
bgcolor="color name | #RRGGBB" (4)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Event Attributes


onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes


align
This attribute is used to align the contents of the cells within the <tbody> element. Common values are center, justify, left, and right. The HTML 4.01 specification also defines a value of char. When align is set to char, the attribute char must be present and set to the character to which cells should be aligned. A common use of this approach would be to set cells to align on a decimal point.

bgcolor
This attribute specifies a background color for the cells within the <tbody> element. Its value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000.

char
This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff
This attribute contains an offset as a positive or negative integer to align characters as related to the char value. A value of 2, for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

valign
This attribute is used to set the vertical alignment for the table cells with the <tbody> element. HTML 4.01 defines baseline, bottom, middle, and top. Internet Explorer replaces middle with center; the effect should be the same.

Example


<table rule="all" bgcolor="yellow">

<tbody align="center" bgcolor="red" style="bodystyle"
  valign="baseline">
  <tr>
<td></td>
<th>
Regular Widget</th>
<th>
Super Widget</th>
  </tr>

  <tr>
<th>
West Coast</th>
<td>
10</td>
<td>
12</td>
  </tr>

  <tr>
<th>
East Coast</th>
<td>
1</td>
<td>
20</td>
  </tr>
</tbody>
</table>

Compatibility


HTML 4, 4.01, XHTML 1.0, 1.1
Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7
Opera 5-7

Notes


This element is contained by the <table> element and contains one or more table rows as indicated by the <tr> element.

For XHTML compatibility, the closing </tbody> tag must be used with this element.

(X)HTML Elements
CSS Properties
Previous: table Next: td
< Home | About | Chapters | Examples | Errata | Reference | Site Map >