<TABLE> tag is the main wrapper for the following table elements : table cells, table headers, table rows, and other tables.

1st table cell,in 1st row and 1st column. 2nd table cell,in the 1st row and 2nd column.
3rd table cell,in 2nd row and 1st column. 4th table cell,in 2nd row and 2nd column of the table.
  figure above shows a table with 2 rows and 2 columns.
<HTML>
  <BODY>
    <TABLE BORDER=1>
      <TR>
        <TD>1st table cell,in 1st row and 1st column.</TD>
        <TD>2nd table cell,in the 1st row and 2nd column.</TD>         
      </TR>
      <TR>            
        <TD>3rd table cell,in 2nd row and 1st column.</TD>
        <TD>4th table cell,in 2nd row and 2nd column of the table.</TD>
      </TR>      
    </TABLE>
  </BODY>
</HTML>

<TABLE> Optional Attributes :
align <TABLE ALIGN = left| right| center..... > align the table to the left, right or center.
bgcolor <TABLE BGCOLOR = #rrggbb|color name..> set the background color for the table.
border <TABLE BORDER = pixels ..... > set table border around all table cells. 0 pixel value for borderless table.
cellpadding <TABLE CELLPADDING = pixels..... > set amount of space between the borders of the table cell and the actual table data cells..
cellspacing <TABLE CELLSPACING = pixel..... > set amount of space in between table data cells.
frame <TABLE FRAME = void| above| below| hsides| lhs| rhs| vsides| box..... >

set which side of the outer table borders should be visible with the following value :
void = removes all outer borders from the table.
above = display a border at the top of the table.
below = display a border at the bottom of the table.
hsides = display borders at both top and bottom of the table.
lhs = display a border at the left hand edges of the table.
rhs = display a border at the right hand edges of the table.
vsides = display borders at both right and left edges of the table.
box = display borders on all four sides of the table

height <TABLE HEIGHT = pixels| percent%..... > set the table height in pixels or percent %.
rules <TABLE RULES = none| basic| rows| cols| all..... > set how internal table borders should be visible with the following values :
none = removes all internal borders.
groups = displays horizontal borders between the <THEAD>, <TBODY> and <TFOOT> sections.
rows = displays horizontal borders between all rows.
cols = displays horizontal borders between all columns.
all = displays all the internal rules.
summary <TABLE SUMMARY = text.....> specifies a summary description for the table.
valign <TABLE VALIGN = top| bottom| center..... > vertical align the table to the top,bottom or center.
width <TABLE WIDTH = pixels| percent %..... > set the table width in pixels or percent %.

Other Attributes :
Core Attributes class, id, style, title.
Internationalization Attributes lang, dir.
Event Attributes onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

  Below describe the attributes for <TABLE> tag in detail.


Core Attributes

Attribute Syntax Description
CLASS

eg. an element's class :
<ELEMENT CLASS = stClass...>

eg. multiple classes in an element :
<ELEMENT CLASS = stClass [ stClass2 [ stClass3 ... ] ] ... >

 

An element can belong to multiple classes.
Multiple elements can share the same class.

Common Usage : to associate a particular style rule in a style sheet with the element.

stClass = a string of class attribute value

Attribute value for CLASS is space-separated list of class names. Begin with a letter range from A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). The value is case-sensitive.

ID <ELEMENT ID = stID... >

A unique id for an element.

Common Usage : as a target for links or for naming particular elements in a style sheet.

stID = a string which specifies attribute value for ID

Attribute value for ID begin with a letter range from A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). The value is case-sensitive.

STYLE <ELEMENT STYLE = stStyle ... >

Specify an inline style for the element.

Common Usage : to associate a particular style sheet rule for the element.

stStyle = a string to specifies the inline style type.

Attribute value for STYLE is the type of the style sheet language or style rules.
Eg. <ELEMENT STYLE="font-family: Verdana">text...</ELEMENT>.

TITLE <ELEMENT TITLE = stTitle... >

Specify the title for the element.

Common Usage : as a tooltip to retrieve advisory information when user hover the mouse over the object.

stTitle = a string that specifies the title attribute value.

Attribute value for TITLE is space/non space-separated list of text.

Internationalization Attributes

Attribute Syntax Description
DIR <ELEMENT DIR = stDir... >

Sets the text direction

stDir = attribute value for DIR

Attribute value for DIR is the directionality of text from left-to-right (DIR=ltr, the default) or right-to-left (DIR=rtl).

LANG <ELEMENT LANG = stLang... >

Sets the language code

stLang = attribute value for LANG

Attribute value for LANG is non space-separated, case-insensitive with the following values : (LANG=en) for English, (LANG=ja) for Japanese and etc.

Event Attributes

Attribute Description
onClick the mouse button is clicked on an element.
onDblClick the mouse button is double-clicked on an element.
onMousedown the mouse button is pressed over an element.
onMouseup the mouse button is released over an element.
onMouseover the mouse is moved onto an element.
onMousemove the mouse is moved while over an element.
onMouseout the mouse is moved away from an element.
onKeypress a key is pressed and released over an element.
onKeydown a key is pressed down over an element.
onKeyup a key is released over an element.