HTML element: <table>
The <table> element specifies the start of a table; it encloses <tbody>, <tfoot>, and <thead> elements, or <caption> and <tr> elements.
Attribute
Attribute |
Value(s) |
Description |
Availability |
|---|---|---|---|
align |
center left right |
Deprecated. This attribute specifies the alignment of the table. |
4.6 or later |
background |
URI |
Deprecated. This attribute defines an image used as the background. |
4.6 or later |
bgcolor |
color |
Deprecated. This attribute specifies the background color for the table. |
4.6 or later |
border |
pixels |
This attribute specifies the thickness of the border around the outside edges of the table and the inner borders of the table cells. |
4.0 or later |
cellpadding |
length |
This attribute specifies the number of pixels of whitespace to add between cells. |
4.0 or later |
cellspacing |
length |
This attribute specifies the number of pixels of whitespace that is rendered between each adjacent cell. |
4.0 or later |
frame |
above below border box hsides lhs rhs void vsides |
This attribute specifies which sides of the table cells are visible. |
4.6 or later |
rules |
all col group none rows |
This attribute specifies where rules will be placed in the table. |
4.6 or later |
summary |
text |
This attribute provides summary text describing the contents of the table. |
4.6 or later |
width |
length |
This attribute sets the width of the table, either in pixels or as a percentage of the browser window. |
4.0 or later |
Common attributes
The <table> element supports the class, dir, id, lang, style, and title attributes.
For more information, see Common attributes.
Event attributes
The <table> element supports the onclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, and onmouseup events.
For more information, see HTML event attributes.